DanBloomberg / leptonica

Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation.
Other
1.76k stars 387 forks source link

Cannot read tif file #642

Closed maxfurioso closed 1 year ago

maxfurioso commented 1 year ago

I ran into a tif file that cannot be read via pixRead(...). I tried a call to pixReadTiff(...) which fails also. The console just tells me this:

Error in pixReadStream: tiff: no pix returned Error in pixRead: pix not read

However, when I open the file with an image viewer or editor everything seems to be fine. Do you have an idea what is wrong here?

Thanks in advance!

I had to zip the TIF file because Github does not accept it. broken.zip

DanBloomberg commented 1 year ago

This is an rgb image with 4 bits/sample, which is not supported for tiff reading in leptonica. Alll rgb or rgba pix in leptonica are 8 bps.

I've fixed the error messages to make this evident when attempting to read such files. Also fixed the documentation in pixReadFromTiffStream() to list explicitly what is not supported. Commit: 4c7dce5

maxfurioso commented 1 year ago

Ah, I see. Thank you for checking that quickly.