Skip to content

Commit

Permalink
fix(api): make size params iterable
Browse files Browse the repository at this point in the history
  • Loading branch information
ssube committed Feb 18, 2023
1 parent 0e108da commit 3ca02d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions api/onnx_web/chain/reduce_thumbnail.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions api/onnx_web/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ def __init__(self, width: int, height: int) -> None:
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)

Expand Down

0 comments on commit 3ca02d4

Please sign in to comment.