-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't open a tiff with old-style jpeg compressed file #7414
Labels
Comments
Can you attach a copy of the image itself? |
I upload it. |
Test code. import sys
from PIL import Image, TiffImagePlugin, features
filename = sys.argv[1]
TiffImagePlugin.DEBUG = True
TiffImagePlugin.READ_LIBTIFF = True
with Image.open(filename, mode='r', formats=['TIFF']) as img:
img.load()
TiffImagePlugin.READ_LIBTIFF = False
print(img.width, img.height)
print(img.info)
print(features.version_codec("libtiff")) |
I've created PR #7415 to resolve this. In the meantime, here's a version of your code with a line added to make it work. import sys
from PIL import Image, TiffImagePlugin, features
filename = sys.argv[1]
TiffImagePlugin.DEBUG = True
TiffImagePlugin.READ_LIBTIFF = True
# New line
TiffImagePlugin.OPEN_INFO[(b"II", 6, (1,), 1, (8,), ())] = ("L", "L")
with Image.open(filename, mode='r', formats=['TIFF']) as img:
img.load()
TiffImagePlugin.READ_LIBTIFF = False
print(img.width, img.height)
print(img.info)
print(features.version_codec("libtiff")) |
Thanks a lot。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What did you do?
I can get the infomation from tiffinfo.
But when i use python, get the under error.
PIL.UnidentifiedImageError: cannot identify image file '20230822143148.tif'
What did you expect to happen?
Pillow will open the file without error.
What actually happened?
I get the under error.
PIL.UnidentifiedImageError: cannot identify image file '20230822143148.tif'
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: