Pyexiv2 crashes on color indexed png

Bug #236462 reported by Zdeněk Dlauhý
2
Affects Status Importance Assigned to Milestone
Phatch
Fix Released
High
Stani
phatch (Ubuntu)
Fix Released
Undecided
Stani

Bug Description

Hi, when i try to work with any indexed color png file, the phatch gives me an error and doesnt work. When i in gimp transform the color to RGB evrything is alright. So what i must do to get it work with indexed png file? Maybe color convert mod to RGB? or what?

i attach the test files

Revision history for this message
Zdeněk Dlauhý (zdlauhy) wrote :
Revision history for this message
Stani (stani) wrote :

Most actions only work on RGB images. So just like in Gimp, you should first add a convert action to RGB or RGBA (if transparency is needed). You can add the convert action by pressing the + toolbar button and select colours from the top right drop down box. Then you will see the "convert mode" action.

That said, I tested this with your image and I see pyexiv2 crashes on it when trying to fetch metadata. So this is a serious bug. I'll fix it as soon as possible.

This is the output of the error log window:
Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/phatch/core/api.py", line 234, in get_photo
    photo = pil.Photo(image_file,image_index,save_metadata,folder)
  File "/usr/lib/python2.5/site-packages/phatch/core/pil.py", line 295, in __init__
    self.init_info(layer,filename,image_index,save_metadata,folder)
  File "/usr/lib/python2.5/site-packages/phatch/core/pil.py", line 312, in init_info
    extract_info(self.info_original,layer.image,location,image_index,folder)
  File "/usr/lib/python2.5/site-packages/phatch/core/pil.py", line 218, in extract_info
    extract_info_pyexiv2(info,location)
  File "/usr/lib/python2.5/site-packages/phatch/core/pil.py", line 153, in extract_info_pyexiv2
    image.readMetadata()
IOError: Failed to read image data

Changed in phatch:
assignee: nobody → stani
importance: Undecided → High
status: New → In Progress
assignee: nobody → stani
status: New → In Progress
Revision history for this message
Stani (stani) wrote :

The fix is now in the bazaar repository. I'll try to add it to my ppa soon.

$ bzr diff
=== modified file 'phatch/core/pil.py'
--- phatch/core/pil.py 2008-04-05 19:23:49 +0000
+++ phatch/core/pil.py 2008-06-01 10:30:43 +0000
@@ -148,9 +148,9 @@
         return
     try:
         image = pyexiv2.Image(location)
+ image.readMetadata()
     except:
         return
- image.readMetadata()
     #exif & iptc
     for keys in [image.exifKeys(),image.iptcKeys()]:
         for key in keys:

$ bzr commit -m "fix indexed colour bug for pyexiv2"
Committing to: /home/stani/sync/python/phatch/trunk/
modified phatch/core/pil.py
Committed revision 534.

Changed in phatch:
status: In Progress → Fix Committed
Revision history for this message
Stani (stani) wrote :

Can you please confirm the latest release fixes your problem?
http://sd-2986.dedibox.fr/photobatch/download/index.html

Or you can also try it from my PPA:
https://launchpad.net/~stani/+archive

Please confirm asap so I can upload this to Debian and Ubuntu. I have verified that it worked myself. Of course you should not forget to add a convert to RGBA action.

Changed in phatch:
status: Fix Committed → Fix Released
Revision history for this message
Zdeněk Dlauhý (zdlauhy) wrote :

Hi, i instaled a version from your ppa, it is works alright:)) but i have strange problems with nautilus-phatch integration.
I save some *.phatch file in .phatch/actionlists/ and sometimes it doesnt show in nautilus integration, sometimes only one of them, sometimes all of them.

Revision history for this message
Zdeněk Dlauhý (zdlauhy) wrote :

I think that this fix has some other effects...

so

Error 0: Nemohu aplikovat akci Převodní mód na obrázek '1.png' v adresáři:
/tmp/1

cannot read interlaced PNG files

Action: {'fields': {'Mode': u'RGB (3x8-bit pixels, true colour)',
            '__enabled__': u'true'},
 'label': 'Convert Mode'}

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/phatch/core/api.py", line 277, in apply_action
    photo = action.apply(photo,setting,cache)
  File "/usr/lib/python2.5/site-packages/phatch/actions/convert_mode.py", line 39, in apply
    photo.convert(mode)
  File "/usr/lib/python2.5/site-packages/phatch/core/pil.py", line 354, in convert
    layer.image = layer.image.convert(mode,*args,**keyw)
  File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 654, in convert
    self.load()
  File "/usr/lib/python2.5/site-packages/PIL/ImageFile.py", line 155, in load
    self.load_prepare()
  File "/usr/lib/python2.5/site-packages/PIL/PngImagePlugin.py", line 337, in load_prepare
    raise IOError("cannot read interlaced PNG files")
IOError: cannot read interlaced PNG files
*
Error 1: Nemohu aplikovat akci Převodní mód na obrázek '3.png' v adresáři:
/tmp/1

cannot read interlaced PNG files

Action: {'fields': {'Mode': u'RGB (3x8-bit pixels, true colour)',
            '__enabled__': u'true'},
 'label': 'Convert Mode'}

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/phatch/core/api.py", line 277, in apply_action
    photo = action.apply(photo,setting,cache)
  File "/usr/lib/python2.5/site-packages/phatch/actions/convert_mode.py", line 39, in apply
    photo.convert(mode)
  File "/usr/lib/python2.5/site-packages/phatch/core/pil.py", line 354, in convert
    layer.image = layer.image.convert(mode,*args,**keyw)
  File "/usr/lib/python2.5/site-packages/PIL/Image.py", line 654, in convert
    self.load()
  File "/usr/lib/python2.5/site-packages/PIL/ImageFile.py", line 155, in load
    self.load_prepare()
  File "/usr/lib/python2.5/site-packages/PIL/PngImagePlugin.py", line 337, in load_prepare
    raise IOError("cannot read interlaced PNG files")
IOError: cannot read interlaced PNG files
*

**************************************
phatch file

fractal@fractal-laptop 14:03:59 :~$ cat .phatch/actionlists/Konvertovat_na_jpg.phatch
{'actions': [{'fields': {'Mode': u'RGB (3x8-bit pixels, true colour)',
                         '__enabled__': u'true'},
              'label': 'Convert Mode'},
             {'fields': {'As': u'jpeg',
                         'Filename': u'<filename>',
                         'In': u'<folder>_phatch/<subfolder>',
                         'JPG Quality': u'85',
                         'JPG Size Maximum': '0kb',
                         'JPG Size Tolerance': '5%',
                         'PNG Optimize': u'false',
                         'Resolution': u'<dpi>',
                         '__enabled__': u'true'},
              'label': 'Save'}],
 'description': u'Zde popi\u0161te seznam akc\xed.'}fractal@fractal-laptop 14:47:51 :~$

Revision history for this message
Stani (stani) wrote :

This is not a side effect of this fix. This is a known issue, see: https://bugs.launchpad.net/phatch/+bug/236548

About the nautilus integration, file a separate bug for it and give more details (which menu entry you choose, etc...)

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package phatch - 0.1.5-1

---------------
phatch (0.1.5-1) unstable; urgency=medium

  [ Stani M ]
  * New upstream release(Closes LP: #228259, #232436, #236282, #236462, #237359)
  * debian/control:
    - Added pkg-config and python-nautilus to build-depends, as
      setup.py uses nautilus-python.pc to look for the nautilus
      extensions path. Closes: #475233.
  * debian/patches:
    - All patches of Ubuntu and Debian are implemented upstream and are removed
      from the package

  [ Piotr Ożarowski ]
  * Bump Standards-Version to 3.8.0 (no changes needed)
  * debian/copyright wrapped at column 80 (where possible)

phatch (0.1.3-2) unstable; urgency=low

  * debian/patches/from_upstream_fix_themes.patch:
    - Fix Phatch not working properly with some themes.
      Thanks to Stani for the patch.

 -- Cesare Tirabassi <email address hidden> Wed, 30 Jul 2008 21:09:03 +0100

Changed in phatch:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.