fix(api): make size params iterable
This commit is contained in:
parent
0e108daa0f
commit
3ca02d4875
|
@ -20,6 +20,9 @@ def reduce_thumbnail(
|
||||||
**kwargs,
|
**kwargs,
|
||||||
) -> Image.Image:
|
) -> Image.Image:
|
||||||
image = source_image.copy()
|
image = source_image.copy()
|
||||||
|
|
||||||
|
# TODO: should use a call to valid_image
|
||||||
image = image.thumbnail((size.width, size.height))
|
image = image.thumbnail((size.width, size.height))
|
||||||
|
|
||||||
logger.info("created thumbnail with dimensions: %sx%s", image.width, image.height)
|
logger.info("created thumbnail with dimensions: %sx%s", image.width, image.height)
|
||||||
return image
|
return image
|
||||||
|
|
|
@ -54,6 +54,9 @@ class Size:
|
||||||
self.width = width
|
self.width = width
|
||||||
self.height = height
|
self.height = height
|
||||||
|
|
||||||
|
def __iter__(self):
|
||||||
|
return iter([self.width, self.height])
|
||||||
|
|
||||||
def __str__(self) -> str:
|
def __str__(self) -> str:
|
||||||
return "%sx%s" % (self.width, self.height)
|
return "%sx%s" % (self.width, self.height)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue