Unverified Commit 68fe4518 authored by Andrew Murray's avatar Andrew Murray Committed by GitHub
Browse files

Fixed Pillow version check for Pillow >= 10 (#2039)


Co-authored-by: default avatarAndrew Murray <radarhere@users.noreply.github.com>
parent a687b83d
......@@ -437,7 +437,9 @@ def _parse_fill(fill, img, min_pil_version):
Returns:
dict: kwarg for ``fillcolor``
"""
if PILLOW_VERSION < min_pil_version:
major_found, minor_found = (int(v) for v in PILLOW_VERSION.split('.')[:2])
major_required, minor_required = (int(v) for v in min_pil_version.split('.')[:2])
if major_found < major_required or (major_found == major_required and minor_found < minor_required):
if fill is None:
return {}
else:
......@@ -853,7 +855,7 @@ def affine(img, angle, translate, scale, shear, resample=0, fillcolor=None):
output_size = img.size
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)
kwargs = {"fillcolor": fillcolor} if PILLOW_VERSION[0] >= '5' else {}
kwargs = {"fillcolor": fillcolor} if int(PILLOW_VERSION.split('.')[0]) >= 5 else {}
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