Skip to content

Commit

Permalink
Fixed PIL size bug in ImageRecordComponent (#889) (#894)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicjac authored Jul 14, 2021
1 parent 0088ad2 commit 944b47c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions icevision/core/record_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -136,7 +136,7 @@ def _repr(self) -> List[str]:
)
return [f"Img: {width}x{height}x{channels} <np.ndarray> Image"]
elif isinstance(self.img, PIL.Image.Image):
height, width = self.img.shape
width, height = self.img.size
return [f"Img: {width}x{height} <PIL.Image; mode='{self.img.mode}'>"]
else:
return [f"Img: {self.img}"]
Expand Down

0 comments on commit 944b47c

Please sign in to comment.