Pillow: Error when loading image

Created on 12 Jan 2018  路  17Comments  路  Source: python-pillow/Pillow

What did you do?

Using sigal to build a gallery. sigal uses Pillow in version 4.3.0, though I build it with 5.0.0 as well and it did not work out (see full history of my issue there).

What did you expect to happen?

No error...

What actually happened?

See here. For the lazy:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/kl0wavrf8a2syn3cfa33hl0b03yyvx80-python-2.7.14-env/lib/python2.7/site-packages/PIL/Image.py", line 2572, in open
    % (filename if filename else fp))
IOError: cannot identify image file './P1010375.png'

What versions of Pillow and Python are you using?

an image that demonstrates the issue.

p1010375-small

(Image was resized from ~85MB size)

The code below was executed with pillow 4.3.0 - the same error was produced with 5.0.0, though:

>>> import PIL
>>> from PIL import Image
>>> Image.open('./P1010375.png')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/kl0wavrf8a2syn3cfa33hl0b03yyvx80-python-2.7.14-env/lib/python2.7/site-packages/PIL/Image.py", line 2572, in open
    % (filename if filename else fp))
IOError: cannot identify image file './P1010375.png'
Awaiting OP Action Bug

All 17 comments

That's a 16 bit per channel RGB image, and Pillow doesn't support multi channel images with more than 8 bpc. It's a longstanding issue.

Thanks for the quick reply.

I just exported the image from darktable again with 8 bit (adobe pdf) and with 8 bit sRGB... same issue, though (or I did something terribly wrong).

Can you post that one?

p1010375_01-small

and

p1010375_02-small

Both resized because of upload limit, using convert P1010375_02.png -resize 25% P1010375_02-small.png.

Both of those worked for me.

Fun times. I have to hit the road now, I will reconfirm this when back home (probably Sunday) thanks for your time and support!

Hi. This issue still exists. What can we do?

Fun fact: I just checked old pictures I already processed with sigal and they are adobe RGB 16 bit ... and they worked!

I tried the following: Exported an images as Adobe RGB and sRGB in both 8 bit and 16 bit (so 4 images). None was recognized.

Using sigal 1.3.0.

For example, this 16 bit Adobe RGB file gets recognized:

( resized because of upload limit, using convert ... -resize 25% ...)

p1020317_small

But others do not.

There's a recently added mode for PNG and TIFF that's a truncated RGB;16B mode, where it returns an 8 bit/channel image from a 16bit original.

How recent is it? Is it in the 5.0.0 release? Because that's what sigal uses on my machine (nixpkgs packaged sigal with pillow 5.0.0).

@matthiasbeyer Still an issue?

I can open and load all of the attached images with Pillow 4.3.0 with Python 2.7 on macOS 10.14. @matthiasbeyer what operating system are you using?

Closing, as I am unable to reproduce, and due to lack of response.

Was this page helpful?
0 / 5 - 0 ratings