Skip to content

Avoid unnecessary convert to RGB and allow using image formats different from PNG

Jerome Flesch requested to merge PauloMigAlmeida:master into master

Created by: PauloMigAlmeida

the image_to_string method on cuneiform.py performs a RGB conversion even if the image is already in the RGB format. I've only added a if statement for checking if we really need to do it.

I've also seen that you use the image.save from PIL(Pillow) to convert this image into a PNG format regardless of image.format. As Cuneiform can read all image formats that ImageMagick.h can and Tesseract can read multiple formats too, it seems only fair that developers may be able use different formats too such as ( JPEG, GIF, PNG an so on ).

Merge request reports