openpaperwork / pyocr

A Python wrapper for Tesseract and Cuneiform -- Moved to Gnome's Gitlab
https://gitlab.gnome.org/World/OpenPaperwork/pyocr
930 stars 152 forks source link

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

Closed PauloMigAlmeida closed 9 years ago

PauloMigAlmeida commented 9 years ago

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 ).

jflesch commented 9 years ago

Thanks :)