improve patch according to reviewer's suggestion
authorThomas Rehn <thomas.rehn@initos.com>
Wed, 19 Nov 2014 09:13:54 +0000 (10:13 +0100)
committerThomas Rehn <thomas.rehn@initos.com>
Wed, 19 Nov 2014 09:13:54 +0000 (10:13 +0100)
addons/hw_escpos/escpos/escpos.py

index d35da17..bb60d63 100644 (file)
@@ -439,11 +439,11 @@ class Escpos:
             img_rgba = Image.open(f)
             img = Image.new('RGB', img_rgba.size, (255,255,255))
             channels = img_rgba.split()
-            kwargs = {}
             if len(channels) > 1:
                 # use alpha channel as mask
-                kwargs['mask'] = img_rgba.split()[3]
-            img.paste(img_rgba, **kwargs)
+                img.paste(img_rgba, mask=channels[3])
+            else:
+                img.paste(img_rgba)
 
             print 'convert image'