← Back to team overview

phatch-dev team mailing list archive

[Merge] lp:~nadiana/phatch/bug_fix_487435 into lp:phatch

 

Nadia Alramli has proposed merging lp:~nadiana/phatch/bug_fix_487435 into lp:phatch.

    Requested reviews:
    stani (stani)

-- 
https://code.launchpad.net/~nadiana/phatch/bug_fix_487435/+merge/20311
Your team Phatch Developers is subscribed to branch lp:phatch.
=== modified file 'phatch/lib/imtools.py'
--- phatch/lib/imtools.py	2010-02-28 06:21:09 +0000
+++ phatch/lib/imtools.py	2010-02-28 14:19:14 +0000
@@ -271,7 +271,7 @@
 
     .. see also:: :func:`reduce_opacity`
     """
-    mark = open_image(mark)
+    mark = convert_safe_mode(open_image(mark))
     opacity /= 100.0
     mark = reduce_opacity(mark, opacity)
     layer = Image.new('RGBA', image_size, (0, 0, 0, 0))
@@ -524,7 +524,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)
 
@@ -666,7 +666,7 @@
     if image.mode in ['CMYK', 'YCbCr', 'P']:
         image = image.convert('RGBA')
     elif image.mode in ['1', 'F']:
-        image = image.convert('LA')
+        image = image.convert('RGBA')
     image.putalpha(alpha)
 
 
@@ -778,8 +778,9 @@
     if image.mode in ['1', 'F']:
         return image.convert('L')
     if image.mode == 'P' and 'transparency' in image.info:
+        img = image.convert('RGBA')
         del image.info['transparency']
-        return image.convert('RGBA')
+        return img
     if image.mode in ['P', 'YCbCr', 'CMYK', 'RGBX']:
         return image.convert('RGB')
     return image


Follow ups