From 3ca02d48755a7153f9aa0645b987b9d35189ea47 Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sat, 18 Feb 2023 05:44:43 -0600 Subject: [PATCH] fix(api): make size params iterable --- api/onnx_web/chain/reduce_thumbnail.py | 3 +++ api/onnx_web/params.py | 3 +++ 2 files changed, 6 insertions(+) diff --git a/api/onnx_web/chain/reduce_thumbnail.py b/api/onnx_web/chain/reduce_thumbnail.py index 50cccc1d..9114c289 100644 --- a/api/onnx_web/chain/reduce_thumbnail.py +++ b/api/onnx_web/chain/reduce_thumbnail.py @@ -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 diff --git a/api/onnx_web/params.py b/api/onnx_web/params.py index 1a645056..4a744138 100644 --- a/api/onnx_web/params.py +++ b/api/onnx_web/params.py @@ -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)