[FIX] tools: colorize image with pillow 4.0

Introduced by python-pillow/Pillow@c3fe5d43 and integrated into pillow 4.0
The size of the image is ignored and must be set using an image or a mask.

This patch is retrocompatible with the previous versions as the changed code was
in the box size computation. With this patch a 4 points box size is given so the
modified code is not executed.

Fixes #14927
This commit is contained in:
Martin Trigaux 2017-01-19 10:03:53 +01:00 committed by Harald Welte
parent 34f009a5ce
commit b7789771f0
1 changed files with 1 additions and 1 deletions

View File

@ -183,7 +183,7 @@ def image_colorize(original, randomize=True, color=(255, 255, 255)):
# generate the background color, past it as background
if randomize:
color = (randint(32, 224), randint(32, 224), randint(32, 224))
image.paste(color)
image.paste(color, box=(0, 0) + original.size)
image.paste(original, mask=original)
# return the new image
buffer = StringIO.StringIO()