1
0
Fork 0

fix(api): make size params iterable

This commit is contained in:
Sean Sube 2023-02-18 05:44:43 -06:00
parent 0e108daa0f
commit 3ca02d4875
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
2 changed files with 6 additions and 0 deletions

View File

@ -20,6 +20,9 @@ def reduce_thumbnail(
**kwargs,
) -> Image.Image:
image = source_image.copy()
# TODO: should use a call to valid_image
image = image.thumbnail((size.width, size.height))
logger.info("created thumbnail with dimensions: %sx%s", image.width, image.height)
return image

View File

@ -54,6 +54,9 @@ class Size:
self.width = width
self.height = height
def __iter__(self):
return iter([self.width, self.height])
def __str__(self) -> str:
return "%sx%s" % (self.width, self.height)