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
'OSError: cannot identify image file' when opening large TIF file #3815
Comments
Debugging like this: diff --git a/src/PIL/Image.py b/src/PIL/Image.py
index 18121c6f..476187da 100644
--- a/src/PIL/Image.py
+++ b/src/PIL/Image.py
@@ -2680,6 +2680,8 @@ def open(fp, mode="r"):
# Leave disabled by default, spams the logs with image
# opening failures that are entirely expected.
# logger.debug("", exc_info=True)
+ if i == "TIFF":
+ raise
continue
except BaseException:
if exclusive_fp:
diff --git a/src/PIL/TiffImagePlugin.py b/src/PIL/TiffImagePlugin.py
index 44dde199..6f37241e 100644
--- a/src/PIL/TiffImagePlugin.py
+++ b/src/PIL/TiffImagePlugin.py
@@ -69,7 +69,7 @@ except ImportError:
# __version__ is deprecated and will be removed in a future version. Use
# PIL.__version__ instead.
__version__ = "1.3.5"
-DEBUG = False # Needs to be merged with the new logging approach.
+DEBUG = True # Needs to be merged with the new logging approach.
# Set these to true to force use of libtiff for reading or writing.
READ_LIBTIFF = False Gives this:
So The supported list: Pillow/src/PIL/TiffImagePlugin.py Lines 145 to 273 in 7d378a8
|
Do you have an image that we are able to include in the test suite, under the Pillow license? |
Hi, Thanks for the investigation. I'm sorry, you can use the image to debug this, but I does not have the Pillow license. Would it be possible to add support for this anyway? |
I've created PR #3817. If you could test it, that would be good. |
Let me ask this - I presume that you're not just interested in opening a file and creating a thumbnail from it, you'd also like to then do something with that data. Save the images as files? Convert them to a different mode? Get the individual pixel values? |
I'd like to save the thumbnail as file, exactly. |
Closing with the merge of #3817 |
What did you do?
I tried to open this large TIF file with Pillow 6.0.0 in the following way:
image = Image.open(input_path)
What did you expect to happen?
No exception. And later I want to able to create thumbnails from the image.
What actually happened?
An exception was thrown:
OSError: cannot identify image file '/code/assets/lib/tests/test_data/alp-1978-big-tif.tif'
What are your OS, Python and Pillow versions?
This is possibly related to #3372
The text was updated successfully, but these errors were encountered: