From 944b47c5694243ba3f3c8c11a6ef56f05fb111eb Mon Sep 17 00:00:00 2001 From: Nicolas Jaccard Date: Wed, 14 Jul 2021 23:23:19 +0100 Subject: [PATCH] Fixed PIL size bug in ImageRecordComponent (#889) (#894) --- icevision/core/record_components.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/icevision/core/record_components.py b/icevision/core/record_components.py index 2fc0b4b8d..5751ca925 100644 --- a/icevision/core/record_components.py +++ b/icevision/core/record_components.py @@ -115,7 +115,7 @@ def set_img(self, img: Union[PIL.Image.Image, np.ndarray]): assert isinstance(img, (PIL.Image.Image, np.ndarray)) self.img = img if isinstance(img, PIL.Image.Image): - height, width = img.shape + width, height = img.size elif isinstance(img, np.ndarray): # else: height, width, _ = self.img.shape @@ -136,7 +136,7 @@ def _repr(self) -> List[str]: ) return [f"Img: {width}x{height}x{channels} Image"] elif isinstance(self.img, PIL.Image.Image): - height, width = self.img.shape + width, height = self.img.size return [f"Img: {width}x{height} "] else: return [f"Img: {self.img}"]