Commit 90771646 authored by SHU's avatar SHU Committed by Francisco Massa
Browse files

Minor fix evaluation formula of PILLOW_VERSION (#895)

Enable fillcolor option for affine transformation for Pillow >= 5.0.0 as described
parent 50d54a82
...@@ -766,7 +766,7 @@ def affine(img, angle, translate, scale, shear, resample=0, fillcolor=None): ...@@ -766,7 +766,7 @@ def affine(img, angle, translate, scale, shear, resample=0, fillcolor=None):
output_size = img.size output_size = img.size
center = (img.size[0] * 0.5 + 0.5, img.size[1] * 0.5 + 0.5) center = (img.size[0] * 0.5 + 0.5, img.size[1] * 0.5 + 0.5)
matrix = _get_inverse_affine_matrix(center, angle, translate, scale, shear) matrix = _get_inverse_affine_matrix(center, angle, translate, scale, shear)
kwargs = {"fillcolor": fillcolor} if PILLOW_VERSION[0] == '5' else {} kwargs = {"fillcolor": fillcolor} if PILLOW_VERSION[0] >= '5' else {}
return img.transform(output_size, Image.AFFINE, matrix, resample, **kwargs) return img.transform(output_size, Image.AFFINE, matrix, resample, **kwargs)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment