Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: imageConversion.py

Issue 6310731435737088: Issue 1894 - Removed "blend(red, green, blue, opacity)" and "grayscale" image conversions (Closed)
Patch Set: Created Jan. 28, 2015, 2:29 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: imageConversion.py
===================================================================
--- a/imageConversion.py
+++ b/imageConversion.py
@@ -63,15 +63,6 @@
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 @@
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):
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld