[Pkg-mozext-commits] [adblock-plus] 408/464: Wait until the overlay is loaded
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:39 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 12b562fb6fa7997d4f9550d5ed4ec717248ecb25
Author: Felix Dahlke <felix at adblockplus.org>
Date: Sat Nov 16 16:21:25 2013 +0100
Wait until the overlay is loaded
---
imageConversion.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/imageConversion.py b/imageConversion.py
index bd9116d..51e632b 100644
--- a/imageConversion.py
+++ b/imageConversion.py
@@ -39,6 +39,12 @@ def get_alpha(image):
return image.point(table, 'L')
+def load_image(path):
+ image = Image.open(path)
+ # Make sure the image is loaded, some versions of PIL load images lazily.
+ 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,
@@ -88,7 +94,7 @@ def filter_blend(image, baseDir, *args):
if len(args) == 2:
filename, opacity = args
- overlay = Image.open(os.path.join(
+ overlay = load_image(os.path.join(
baseDir,
*filename.split('/')
))
@@ -116,8 +122,7 @@ def convertImages(params, files):
for filename, chain in metadata.items('convert_img'):
baseDir = os.path.dirname(metadata.option_source('convert_img', filename))
steps = re.split(r'\s*->\s*', chain)
- image = Image.open(os.path.join(baseDir, *steps.pop(0).split('/')))
- image.load()
+ image = load_image(os.path.join(baseDir, *steps.pop(0).split('/')))
for step in steps:
filter, args = re.match(r'([^(]+)(?:\((.*)\))?', step).groups()
--
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