Skip to content
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

cannot identify image file #287

Closed
matthiasbeyer opened this issue Jan 12, 2018 · 13 comments
Closed

cannot identify image file #287

matthiasbeyer opened this issue Jan 12, 2018 · 13 comments

Comments

@matthiasbeyer
Copy link

Hi,

first: Thanks for this awesome tool! Am using it for ~half a year now and I love it so far!

I got this error (both with sigal 1.0.1 and 1.3.0, though 1.0.1 did not include the backtrace):

INFO: Processing /home/[...]375.png
INFO: Failed to process: IOError("cannot identify image file u'/home/m/archive/blog/pictures/iceland_2017/P1010375.png'",)
Traceback (most recent call last):
  File "/nix/store/iqs96qsi2vhcxbmg93vzzdz2jgp99jyc-sigal-1.3.0/bin/.sigal-wrapped", line 12, in <module>
    sys.exit(main())
  File "/nix/store/3cp18nir0w8zvy4brkmz33bjnszsybpf-python2.7-click-6.7/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/nix/store/3cp18nir0w8zvy4brkmz33bjnszsybpf-python2.7-click-6.7/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/nix/store/3cp18nir0w8zvy4brkmz33bjnszsybpf-python2.7-click-6.7/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/nix/store/3cp18nir0w8zvy4brkmz33bjnszsybpf-python2.7-click-6.7/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/nix/store/3cp18nir0w8zvy4brkmz33bjnszsybpf-python2.7-click-6.7/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/nix/store/iqs96qsi2vhcxbmg93vzzdz2jgp99jyc-sigal-1.3.0/lib/python2.7/site-packages/sigal/__init__.py", line 142, in build
    gal.build(force=force)
  File "/nix/store/iqs96qsi2vhcxbmg93vzzdz2jgp99jyc-sigal-1.3.0/lib/python2.7/site-packages/sigal/gallery.py", line 638, in build
    for res in self.pool.imap_unordered(worker, media_list):
  File "/nix/store/6yb5rvr6rvgvx8ylpchwz808djfw07rb-python-2.7.14/lib/python2.7/multiprocessing/pool.py", line 673, in next
    raise value
IOError: cannot identify image file u'/home[...]'

(Don't mind the strange pathes, this is NixOS).

I think there's very little information actually in the error message... what does "identify" mean, for example.

If you want, I can share the image with you so you can try to reproduce!

@saimn
Copy link
Owner

saimn commented Jan 12, 2018

Could you try with only one process and debug mode (-d -n 1), it would give more information.

@matthiasbeyer
Copy link
Author

matthiasbeyer commented Jan 12, 2018

Sure.

sigal 1.0.1

[...]
INFO: Processing /home/[...]P1010375.png
INFO: Failed to process: IOError("cannot identify image file u'/home[...]P1010375.png'",)
ERROR: Some files have failed to be processed:
ERROR:   - iceland_2017/P1010375.png
ERROR: You can run sigal in verbose (--verbose) or debug (--debug) mode to get more details.

INFO: Theme  : /nix/store/d5j8f2z43xpzb5qbzjfjiv1z8qvskibq-python2.7-sigal-1.0.1/lib/python2.7/site-packages/sigal/themes/photoswipe
INFO: Output album : <Album>(path='.', title=u'pictures')
DEBUG: Use 1st landscape image as thumbnail for <Album>(path=u'iceland_2017', title=u'Iceland 2017') : iceland_2017/thumbnails/P1010306 - P1010324.png
DEBUG: Use the 1st image as thumbnail for <Album>(path=u'other', title=u'Other pictures') : other/thumbnails/P1010120.png
INFO: Output album : <Album>(path=u'other', title=u'Other pictures')
INFO: Output album : <Album>(path=u'iceland_2017', title=u'Iceland 2017')
Done.
Processed 1 images (14 skipped, 1 failed) and 0 videos in 0.12 seconds.

sigal 1.3.0

[...]
INFO: Processing /home[...]P1010375.png
INFO: Failed to process: IOError("cannot identify image file u'/home[...]P1010375.png'",)
Traceback (most recent call last):
  File "/nix/store/iqs96qsi2vhcxbmg93vzzdz2jgp99jyc-sigal-1.3.0/bin/.sigal-wrapped", line 12, in <module>
    sys.exit(main())
  File "/nix/store/3cp18nir0w8zvy4brkmz33bjnszsybpf-python2.7-click-6.7/lib/python2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/nix/store/3cp18nir0w8zvy4brkmz33bjnszsybpf-python2.7-click-6.7/lib/python2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/nix/store/3cp18nir0w8zvy4brkmz33bjnszsybpf-python2.7-click-6.7/lib/python2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/nix/store/3cp18nir0w8zvy4brkmz33bjnszsybpf-python2.7-click-6.7/lib/python2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/nix/store/3cp18nir0w8zvy4brkmz33bjnszsybpf-python2.7-click-6.7/lib/python2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/nix/store/iqs96qsi2vhcxbmg93vzzdz2jgp99jyc-sigal-1.3.0/lib/python2.7/site-packages/sigal/__init__.py", line 142, in build
    gal.build(force=force)
  File "/nix/store/iqs96qsi2vhcxbmg93vzzdz2jgp99jyc-sigal-1.3.0/lib/python2.7/site-packages/sigal/gallery.py", line 657, in build
    res = process_file(media_item)
  File "/nix/store/iqs96qsi2vhcxbmg93vzzdz2jgp99jyc-sigal-1.3.0/lib/python2.7/site-packages/sigal/gallery.py", line 700, in process_file
    ret = processor(*args[3:])
  File "/nix/store/iqs96qsi2vhcxbmg93vzzdz2jgp99jyc-sigal-1.3.0/lib/python2.7/site-packages/sigal/image.py", line 153, in process_image
    generate_image(filepath, outname, settings, options=options)
  File "/nix/store/iqs96qsi2vhcxbmg93vzzdz2jgp99jyc-sigal-1.3.0/lib/python2.7/site-packages/sigal/image.py", line 73, in generate_image
    img = PILImage.open(source)
  File "/nix/store/drylz6wbdnwkydwdf8zzx6jw7k2hd81k-python2.7-Pillow-4.3.0/lib/python2.7/site-packages/PIL/Image.py", line 2572, in open
    % (filename if filename else fp))
IOError: cannot identify image file u'/home[...]P1010375.png'

All other images work btw. I have the images inside a git-annex repository and they work. Unlocking the file (replacing the symlink git-annex creates) and running sigal gives the same results.


btw: Both started with sigal build -d -n 1

@saimn
Copy link
Owner

saimn commented Jan 12, 2018

Ok, so it's really a PIL (or Pillow, which one do you use?) issue with this file, which may be corrupted. If you are using Pillow and the file seems valid, it may be something to report on their side.

@matthiasbeyer
Copy link
Author

Ok, so it's really a PIL (or Pillow, which one do you use?)

Pardon me? 😄 If you mean dependencies, sigal is packaged with: jinja2 markdown pillow pilkit clint click blinker in nixpkgs.

The file is brand-new - I just edited the raw file and created the png from it... so I doubt that there is file-corruption going on (besides, I can view the image with an image-viewer...).

@saimn
Copy link
Owner

saimn commented Jan 12, 2018

Yes sorry ;), Sigal uses the PIL/Pillow library for image reading etc. Can you try this in a Python console:

import PIL
print(PIL.PILLOW_VERSION)
print(PIL.Image.open('/the/file.png'))

@matthiasbeyer
Copy link
Author

>>> import PIL
>>> print(PIL.PILLOW_VERSION)
4.3.0
>>> print(PIL.Image.open('./P1010375.png'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Image'
>>> 

@saimn
Copy link
Owner

saimn commented Jan 12, 2018

Hmm, maybe try with

from PIL import Image
Image.open('...')

@matthiasbeyer
Copy link
Author

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'

From what I understand, this sounds like an upstream issue now, right?

@saimn
Copy link
Owner

saimn commented Jan 12, 2018

Yes 😉

@matthiasbeyer
Copy link
Author

matthiasbeyer commented Jan 12, 2018

I just filed an update for pillow ... let me check whether this fixes the issue.


Update: It does not.

@saimn
Copy link
Owner

saimn commented Jan 12, 2018

Given the comments in the Pillow issue I think I can close this now, feel free to reopen if you still have the issue with sigal.

@saimn saimn closed this as completed Jan 12, 2018
@matthiasbeyer
Copy link
Author

As this issue still exists for me, I just want to confirm: There are two image processing libraries I can use with sigal? Pillow and PIL? Because I could try to use the other lib and reproduce...

If you check out the issue in the pillow repository, you'll see that they state that Adobe RGB 16 bit does not work, but all images I processed so far are Adobe RGB 16 bit. So I wonder whether sigal used the other image processing library for those and fails to do so now...

@saimn
Copy link
Owner

saimn commented Feb 28, 2018

Pillow started as a fork of PIL, which was not compatible with Python 3 and not updated. So you should just use Pillow, PIL is dead. http://pillow.readthedocs.io/en/latest/about.html#what-about-pil

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants