0

I have a multilayer .tiff image that I can open in matlab with either imfinfo or imread. The results look as I expect.

However, I can't open the image in python: PIL.Image.open fails with UnidentifiedImageError: cannot identify image file, and exifreader gives nonsense for the image tags.

I assume there's some part of the tiff standard that the python packages are checking and matlab is not, but I don't know how to debug further. What are the first steps to take to figure out how the image is corrupted?

Heshy
  • 382
  • 1
  • 10
  • Can you open it in other applications, like a paint or image processing program? Also, check this answer; there is an issue opening some TIFF files, it appears: https://stackoverflow.com/questions/7569553/working-with-tiffs-import-export-in-python-using-numpy ; pytiff might be the ticket. – asylumax Jun 03 '20 at 17:34
  • I instead would suggest ussing libtiff as this answer: https://stackoverflow.com/a/44915514/1485872 . Likely you have a higher than 8 bit depth image. Libtiff is the standard to handle proper tiff data – Ander Biguri Jun 03 '20 at 18:21
  • 1
    “I assume there's some part of the TIFF standard...” A TIFF file can contain a lot of different image types and in a lot of different formats. Every reader in the world only reads a subset of possible standard-compliant TIFF files (by necessity, it’s impossible to support it all). – Cris Luengo Jun 03 '20 at 18:32
  • 1
    Could be a [BigTIFF](https://www.awaresystems.be/imaging/tiff/bigtiff.html) file, which is not supported by Pillow. – cgohlke Jun 03 '20 at 20:19
  • @cgohlke You got it! Thanks a lot! If you post that as an answer I'll accept it. – Heshy Jun 04 '20 at 12:34

0 Answers0