Commit c791bcd8 authored by Romain Courteaud's avatar Romain Courteaud

Generate by default indexed 8bpp tiff image.

This is the expected parameter to allow tesseract convertion.
parent 05b2d82a
...@@ -22,6 +22,9 @@ class ImageMagickTransforms: ...@@ -22,6 +22,9 @@ class ImageMagickTransforms:
parameter_list.extend(['-resize', '%sx%s!' % (newwidth, newheight)]) parameter_list.extend(['-resize', '%sx%s!' % (newwidth, newheight)])
elif newwidth or newheight: elif newwidth or newheight:
parameter_list.extend(['-resize', '%sx%s' % (newwidth, newheight)]) parameter_list.extend(['-resize', '%sx%s' % (newwidth, newheight)])
depth = kwargs.get('depth','')
if depth:
parameter_list.extend(['-depth', '%s' % depth, '-type', 'Palette'])
parameter_list.append('%s:-' % self.format) parameter_list.append('%s:-' % self.format)
process = subprocess.Popen(parameter_list, process = subprocess.Popen(parameter_list,
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
......
...@@ -6,6 +6,9 @@ class image_to_tiff(ImageMagickTransforms): ...@@ -6,6 +6,9 @@ class image_to_tiff(ImageMagickTransforms):
output = 'image/tiff' output = 'image/tiff'
format = 'tiff' format = 'tiff'
def convert(self, orig, data, depth=8, **kwargs):
return ImageMagickTransforms.convert(self, orig, data, depth=depth, **kwargs)
def register(): def register():
return image_to_tiff() return image_to_tiff()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment