diff --git a/src/gourmet/reccard.py b/src/gourmet/reccard.py index 7eb75d33..3ddf0010 100644 --- a/src/gourmet/reccard.py +++ b/src/gourmet/reccard.py @@ -1472,6 +1472,7 @@ def __init__(self, rec_card): self.addW = self.ui.get_object('addImage') self.delW = self.ui.get_object('delImageButton') self.image: Image.Image = None + self.thumbnail: Image.Image = None def get_image(self, rec: Optional['RowProxy'] = None): """Set image based on current recipe.""" @@ -1513,7 +1514,7 @@ def commit(self) -> Union[Tuple[bytes, bytes], Tuple[None, None]]: debug("commit (self):", 5) if self.image: self.imageW.show() - return iu.image_to_bytes(self.image), iu.image_to_bytes(self.thumb) + return iu.image_to_bytes(self.image), iu.image_to_bytes(self.thumbnail) else: self.imageW.hide() return None, None @@ -1533,8 +1534,6 @@ def draw_image(self): size = (100, 100) self.image.thumbnail(size) - self.thumb = self.image.copy() - self.thumb.thumbnail((40, 40)) self.set_from_bytes(iu.image_to_bytes(self.image)) def show_image (self): @@ -1552,6 +1551,8 @@ def set_from_bytes(self, bytes_: bytes): self.orig_pixbuf = pb self.image = iu.bytes_to_image(bytes_) + self.thumbnail = self.image.copy() + self.thumbnail.thumbnail((40, 40)) self.show_image() self.edited = True