[Pkg-mozext-commits] [adblock-plus] 08/41: Issue 1894 - Removed "blend(red, green, blue, opacity)" and "grayscale" image conversions

David Prévot taffit at moszumanska.debian.org
Wed Mar 18 18:21:37 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository adblock-plus.

commit 8eb5756022591ef823932e8fa35905ad172863bf
Author: Sebastian Noack <sebastian at adblockplus.org>
Date:   Wed Jan 28 15:29:14 2015 +0100

    Issue 1894 - Removed "blend(red, green, blue, opacity)" and "grayscale" image conversions
---
 imageConversion.py | 34 +++++-----------------------------
 1 file changed, 5 insertions(+), 29 deletions(-)

diff --git a/imageConversion.py b/imageConversion.py
index 4b9d831..e56dae7 100644
--- a/imageConversion.py
+++ b/imageConversion.py
@@ -63,15 +63,6 @@ def ensure_same_mode(im1, im2):
     im2 if im2.mode == mode else im2.convert(mode),
   )
 
-def filter_grayscale(image, baseDir):
-  alpha = get_alpha(image)
-  image = image.convert('L')
-
-  if alpha:
-    image.putalpha(alpha)
-
-  return image
-
 def filter_contrastToAlpha(image, baseDir):
   alpha = Image.new('L', image.size, 255)
   alpha.paste(image, mask=get_alpha(image))
@@ -80,30 +71,15 @@ def filter_contrastToAlpha(image, baseDir):
 
   return Image.merge('LA', [Image.new('L', image.size), alpha])
 
-def filter_blend(image, baseDir, *args):
-  if len(args) == 2:
-    filename, opacity = args
-
-    overlay = load_image(os.path.join(
+def filter_blend(image, baseDir, filename, opacity):
+  image, overlay = ensure_same_mode(
+    image,
+    load_image(os.path.join(
       baseDir,
       *filename.split('/')
     ))
-  else:
-    red, green, blue, opacity = args
-
-    overlay = Image.new('RGB', image.size, (
-      int(red),
-      int(green),
-      int(blue),
-    ))
-
-    # if the background image has an alpha channel copy it to
-    # the overlay, so that transparent areas stay transparent.
-    alpha = get_alpha(image)
-    if alpha:
-      overlay.putalpha(alpha)
+  )
 
-  image, overlay = ensure_same_mode(image, overlay)
   return Image.blend(image, overlay, float(opacity))
 
 def convertImages(params, files):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git



More information about the Pkg-mozext-commits mailing list