"Unrecognized image mode" in multipage tiff file while loading a specific tiff page

31 views Asked by At

We are trying to read multipage tiff file frame by frame using PIL. In one multipage tiff file, with file Bit depth as 1 and compression as Group4 we are facing "Unrecognized image mode" error.

On analyzing this we found, one page in the multipage tiff has image mode as "P" and compression as TIFF_LZW and when this page gets loaded by PIL, it throwing below error. Other page image mode are "1" and compression as GROUP4

` self._ensure_mutable()

File "****\env\lib\site-packages\PIL\Image.py", line 599, in _ensure_mutable

self._copy()

File "***\env\lib\site-packages\PIL\Image.py", line 592, in _copy

self.load()

File "***\env\lib\site-packages\PIL\TiffImagePlugin.py", line 1181, in load

return self._load_libtiff()

File "***\env\lib\site-packages\PIL\TiffImagePlugin.py", line 1219, in _load_libtiff

Image.Image.load(self)

File "***\env\lib\site-packages\PIL\Image.py", line 820, in load

self.im.putpalette(mode, arr)

ValueError: unrecognized image mode`

On further investigating this we found that, there is an image palatte associated with the image.So while trying to load any page in the image, it is calling this method - self.im.putpalette(mode, arr).Since one page is palettized it is trying to load the remaining pages also with the same property and failing. This is my understanding on this

0

There are 0 answers