From fa20e7f834a1385f383f09a3aa8f4fb4bb86da18 Mon Sep 17 00:00:00 2001 From: Shlomi Fish Date: Fri, 5 Apr 2019 17:13:13 +0300 Subject: [PATCH] Try fixing issue #108 - compat with pillow 6.0 See https://github.com/shlomif/PySolFC/issues/108 . --- pysollib/mfxutil.py | 2 +- pysollib/ui/tktile/tkutil.py | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/pysollib/mfxutil.py b/pysollib/mfxutil.py index a0d0aed4..f461ed10 100644 --- a/pysollib/mfxutil.py +++ b/pysollib/mfxutil.py @@ -51,7 +51,7 @@ from PIL import PpmImagePlugin # noqa: F401 Image._initialized = 2 USE_PIL = False -if TOOLKIT == 'tk' and Image and Image.VERSION >= '1.1.7': +if TOOLKIT == 'tk' and Image: USE_PIL = True # debug diff --git a/pysollib/ui/tktile/tkutil.py b/pysollib/ui/tktile/tkutil.py index af43130a..0319e6d3 100644 --- a/pysollib/ui/tktile/tkutil.py +++ b/pysollib/ui/tktile/tkutil.py @@ -353,15 +353,10 @@ def shadowImage(image, color='#3896f8', factor=0.3): if not hasattr(image, '_pil_image'): return None im = image._pil_image - if Image.VERSION >= '1.1.7': - # use an alpha image - sh = Image.new('RGBA', im.size, color) - sh.putalpha(100) - out = Image.composite(sh, im, im) - return PIL_Image(image=out) + # use an alpha image sh = Image.new('RGBA', im.size, color) - tmp = Image.blend(im, sh, factor) - out = Image.composite(tmp, im, im) + sh.putalpha(100) + out = Image.composite(sh, im, im) return PIL_Image(image=out)