mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Try fixing issue #108 - compat with pillow 6.0
See https://github.com/shlomif/PySolFC/issues/108 .
This commit is contained in:
parent
2e67242e92
commit
1d3ffc4e1d
2 changed files with 4 additions and 9 deletions
|
@ -51,7 +51,7 @@ if TOOLKIT == 'tk':
|
||||||
from PIL import PpmImagePlugin # noqa: F401
|
from PIL import PpmImagePlugin # noqa: F401
|
||||||
Image._initialized = 2
|
Image._initialized = 2
|
||||||
USE_PIL = False
|
USE_PIL = False
|
||||||
if TOOLKIT == 'tk' and Image and Image.VERSION >= '1.1.7':
|
if TOOLKIT == 'tk' and Image:
|
||||||
USE_PIL = True
|
USE_PIL = True
|
||||||
|
|
||||||
# debug
|
# debug
|
||||||
|
|
|
@ -353,15 +353,10 @@ def shadowImage(image, color='#3896f8', factor=0.3):
|
||||||
if not hasattr(image, '_pil_image'):
|
if not hasattr(image, '_pil_image'):
|
||||||
return None
|
return None
|
||||||
im = image._pil_image
|
im = image._pil_image
|
||||||
if Image.VERSION >= '1.1.7':
|
# use an alpha image
|
||||||
# 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)
|
|
||||||
sh = Image.new('RGBA', im.size, color)
|
sh = Image.new('RGBA', im.size, color)
|
||||||
tmp = Image.blend(im, sh, factor)
|
sh.putalpha(100)
|
||||||
out = Image.composite(tmp, im, im)
|
out = Image.composite(sh, im, im)
|
||||||
return PIL_Image(image=out)
|
return PIL_Image(image=out)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue