-
-
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
OSError: -9 at img.show() with a .CR2 image #5317
Comments
Do you have an example file you could attach that reproduces the problem? You said it worked flawlessly before. Which Pillow version that was with? |
The file is larger than 10 MB, so here is a download link: https://mega.nz/file/V9cGkD7C#Bi-M5H4X9tyv4sPmceJ2lc3bELPiSBECrYe8QsKFAI4 I do not recall in what version of Pillow it was working previously. |
I'm pretty surprised that a CR2 image actually works with Pillow at all, given that it's camera raw and Pillow hasn't ever tried to support it. On the other hand, lots of file formats are actually Tiff under the hood, so it's possible to get metadata from them even if we don't understand the actual pixels. |
Yeah, CoreImage/Quartz has been able to do raw processing since forever. 10.4 at least IIRC. |
|
It may be a little different, but it's a similar issue. |
It might not be actual raw processing. It might be displaying just the embedded JPEG or preview image, which I guess is what Pillow also tries to access. There are multiple images in this TIFF file, the actual "raw" is in IFD3 (though Canon sRAW is not really raw data and is to be avoided). IFD0 is a 3 color channel (i.e. already processed RGB) 3.5 MB JPEG:
|
Another part of the puzzle might be that the mandatory For example, when |
It looks like missing OTOH, there have been quite a few changes to decoding OJPEG images since libtiff 4.0.10 when the problem started appearing, so this might not be Pillow's fault... But at the same time, it seems it should be possible to make it work with libtiff 4.2.0. |
I thought the OSError: -9 was coming somewhere later from the C code in this case, i.e. inside |
I've updated my comment - #5372 has C changes that fix the -9. |
Hi everyone,
Today I wanted to run a script I regularly use for image sorting, however I got an
OSError: -9
occurring at theimg.show()
. A simplified script which can replicate this behaviour is provided at the end of this post. The image I was trying to show is a .CR2, a Canon RAW image. I have used this script extensively for more than a year on .CR2 files and it behaved flawlessly all the time, until now. It occurs with every .CR2 image, even ones that I know I have opened with Pillow before.The full error log:
Installed modules (made a fresh conda env for this report):
What did you do?
Run the script below.
What did you expect to happen?
To show the image.
What actually happened?
An error occurred and no image was shown.
What are your OS, Python and Pillow versions?
Code:
The text was updated successfully, but these errors were encountered: