-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Fails to open OME-TIFF example data files #811
Comments
I'm not at a computer to test, but just to confirm: does this happen with Pillow (the PIL fork)? Which version of Pillow do you have? |
Yes, this is with Pillow 2.5.0, Python 3.4. I actually haven't tested this with PIL. |
The actual problem with that file is that it is specified as a bigendian 8-bit signed integer format, which we don't have listed in the formats that we support. This past includes a mode line that will read the format and store it in an unsigned integer. Visual inspection of the image looks okay. The XML from the OME format shows up in the tags directory. diff --git a/PIL/TiffImagePlugin.py b/PIL/TiffImagePlugin.py
index 2e49931..d96542a 100644
--- a/PIL/TiffImagePlugin.py
+++ b/PIL/TiffImagePlugin.py
@@ -185,6 +185,7 @@ OPEN_INFO = {
(MM, 1, 1, 1, (1,), ()): ("1", "1"),
(MM, 1, 1, 2, (1,), ()): ("1", "1;R"),
(MM, 1, 1, 1, (8,), ()): ("L", "L"),
+ (MM, 1, 2, 1, (8,), ()): ("L", "L"), #signed 8 bit???
(MM, 1, 1, 1, (8,8), (2,)): ("LA", "LA"),
(MM, 1, 1, 2, (8,), ()): ("L", "L;R"),
(MM, 1, 1, 1, (16,), ()): ("I;16B", "I;16B"), |
The Image file formats doc does not mention this limitation. Is this a non-standard TIFF format? (I don't know.) |
There are many combinations, we support 60 or more of them. See lines ~145->212 of TiffImagePlugin for the combinations. I've never seen a signed 8bit image before, so if it's not rare, it's not exactly common either. We don't have a specific mode for signed 8 bit images, so while we can read the image, we don't actually report the bytes correctly. (we'd return 0-255, not -127->127). |
Just a direct link to the sample image - https://downloads.openmicroscopy.org/images/OME-TIFF/2016-06/bioformats-artificial/single-channel.ome.tiff |
I've created PR #7111 to resolve this. |
OME-TIFF is a TIFF format that embeds some microscopy-specific metadata as an XML comment embedded in the TIFF header. Sample data is available at https://www.openmicroscopy.org/site/support/ome-model/ome-tiff/data.html, but PIL fails to open
single-channel.ome.tiff
(throwingOSError: cannot identify image file 'single-channel.ome.tiff'
).The text was updated successfully, but these errors were encountered: