Comment 18 for bug 487435

Nadia Alramli (nadiana) wrote :

This hack will work. But the issue will happen again with LA mode images. The problem is actually because of a PIL bug. It doesn't handle LA mode properly. We should change get_alpha to use 'RGBA' instead of 'LA'. I didn't have the chance to test this change, but I'm sure it will fix the bug.

=== modified file 'phatch/lib/imtools.py'
--- phatch/lib/imtools.py 2009-10-06 05:47:25 +0000
+++ phatch/lib/imtools.py 2009-12-14 23:15:38 +0000
@@ -507,7 +507,7 @@
     if has_alpha(image):
         return image.split()[-1]
     if image.mode == 'P' and 'transparency' in image.info:
- return image.convert('LA').split()[-1]
+ return image.convert('RGBA').split()[-1]
     # No alpha layer, create one.
     return Image.new('L', image.size, 255)