Index: imageConversion.py |
diff --git a/imageConversion.py b/imageConversion.py |
index bbdcfc52564e71bf4a66025a1101a71af9b0ef38..abab5d3eb4e52ec298664d30cf5f204597cbfe81 100644 |
--- a/imageConversion.py |
+++ b/imageConversion.py |
@@ -22,34 +22,6 @@ def load_image(path): |
image.load() |
return image |
-def ensure_same_mode(im1, im2): |
- # if both images already have the same mode (and palette, in |
- # case of mode P), don't convert anything. Images with mode P, |
- # and a different palette, are the only case where images |
- # using the same mode, will be incompatible with each other. |
- if im1.mode == im2.mode and (im1.mode != 'P' or im1.getpalette() == im2.getpalette()): |
- return (im1, im2) |
- |
- # if any given image has a mode that supports colors convert both |
- # images to RGB or RGBA, otherwise convert both images to L or LA. |
- # If any given image has an alpha channel (or mode P which |
- # can store transparent pixels too) convert both images |
- # to RGBA or LA, otherwise convert both images to RGB or L. |
- mode = max( |
- Image.getmodebase(im1.mode), |
- Image.getmodebase(im2.mode), |
- |
- key=('L', 'RGB').index |
- ) |
- |
- if any(im.mode in ('RGBA', 'LA', 'P') for im in (im1, im2)): |
- mode += 'A' |
- |
- return ( |
- im1 if im1.mode == mode else im1.convert(mode), |
- im2 if im2.mode == mode else im2.convert(mode), |
- ) |
- |
def filter_contrastToAlpha(image, baseDir): |
# In order to generate an alpha channel for images using a palette, we must |
# convert the image to RGBA. It's important to use RGBA, not LA (grayscale+alpha), |
@@ -78,17 +50,6 @@ def filter_contrastToAlpha(image, baseDir): |
return Image.merge('LA', [Image.new('L', image.size), alpha]) |
-def filter_blend(image, baseDir, filename, opacity): |
- image, overlay = ensure_same_mode( |
- image, |
- load_image(os.path.join( |
- baseDir, |
- *filename.split('/') |
- )) |
- ) |
- |
- return Image.blend(image, overlay, float(opacity)) |
- |
def convertImages(params, files): |
metadata = params['metadata'] |