Phatch distorts original image in some images in add canvas

Bug #297241 reported by Ader
2
Affects Status Importance Assigned to Milestone
Phatch
Fix Released
High
Stani

Bug Description

I try to add canvas to some images of IPA characters. Some of the images become distorted, some do not. Attached you will find a zip of all images with the converted versions.

Action list is as follows:
{'actions': [{'fields': {'Align Horizontal': u'50',
                         'Align Vertical': u'50',
                         'Background Colour': u'#ffffff',
                         'Height': u'100 px',
                         'Opacity': u'100',
                         'Resolution': u'<dpi>',
                         'Width': u'100 px',
                         '__enabled__': u'true'},
              'label': 'Canvas'},
             {'fields': {'As': u'gif',
                         'Filename': u'<filename>',
                         'In': u'/var/www/ipa/gfx/consonants/memory',
                         'JPG Quality': u'85',
                         'JPG Size Maximum': '0kb',
                         'JPG Size Tolerance': '5%',
                         'PNG Optimize': u'yes',
                         'Resolution': u'<dpi>',
                         '__enabled__': u'true'},
              'label': 'Save'}],
 'description': u'Describe here the action list.'}

Rasmus

Revision history for this message
Ader (rasmusrim) wrote :
Revision history for this message
Stani (stani) wrote :

Thanks for reporting this bug and providing me with images. I'll tackle this next time on my round of bug fixing.

Changed in phatch:
assignee: nobody → stani
Revision history for this message
Stani (stani) wrote :

The fix is commited upstream in revision 549. However make sure that your images do not have a transparent background such as 1.3.1.gif

$ bzr diff
=== modified file 'phatch/actions/canvas.py'
--- phatch/actions/canvas.py 2008-07-31 10:24:11 +0000
+++ phatch/actions/canvas.py 2009-02-17 00:03:08 +0000
@@ -45,8 +45,12 @@
         new_canvas = Image.new(image.mode,new_size,background_colour)
     else:
         new_canvas = Image.new('RGB',new_size,background_colour)
- new_canvas = new_canvas.convert(image.mode)
+ if image.mode == 'L':
+ new_canvas = new_canvas.convert(image.mode)
     new_canvas.paste(image,(x,y))
+ if image.mode == 'P':
+ new_canvas = new_canvas.convert(image.mode,
+ palette=Image.ADAPTIVE,dither=Image.NONE)

     return new_canvas

$ bzr commit -m "fix canvas bug for gif"
Committing to: /home/stani/sync/python/phatch/trunk/
modified phatch/actions/canvas.py
Committed revision 549.

It will be included in the new release. If you can't wait, you can download the new canvas plugin from:
http://bazaar.launchpad.net/~stani/phatch/dev/annotate/head%3A/phatch/actions/canvas.py

and replace it with the one in phatch/actions if you want to test it.

Changed in phatch:
importance: Undecided → High
status: New → Fix Committed
Stani (stani)
Changed in phatch:
milestone: none → 0.2.1
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

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