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

Unified Diff: imageConversion.py

Issue 4826241328742400: Made import of PIL compatible to environments where you have to import Image directly (Closed)
Patch Set: Created Nov. 15, 2013, 9:36 a.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
@@ -19,7 +19,12 @@
import re
from StringIO import StringIO
-import PIL.Image
+try:
+ from PIL import Image
+ from PIL import ImageOps
+except ImportError:
+ import Image
+ import ImageOps
def get_alpha(image):
if image.mode in ('RGBA', 'LA'):
@@ -72,8 +77,6 @@
return image
def filter_contrastToAlpha(image, baseDir):
- import PIL.ImageOps
-
alpha = PIL.Image.new('L', image.size, 255)
alpha.paste(image, mask=get_alpha(image))
alpha = PIL.ImageOps.invert(alpha)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld