shrinking photo inside frame now

This commit is contained in:
Patrick Haßel 2025-06-28 07:23:54 +02:00
parent 4176c473e3
commit 8f091c8831
2 changed files with 4 additions and 4 deletions

View File

@ -150,8 +150,7 @@ class Fotobox:
self._printer.qr(self._choice.urlWithProtocol, center=True, size=5) self._printer.qr(self._choice.urlWithProtocol, center=True, size=5)
self._printer.text(url + "\n") self._printer.text(url + "\n")
self._printer.text("/p/" + self._choice.code + "\n") self._printer.text("/p/" + self._choice.code + "\n")
self._printer.text(" \n") self._printer.cut()
self._printer.text(" \n")
self._printed = True self._printed = True
except Exception as e: except Exception as e:

View File

@ -21,8 +21,9 @@ class Photo:
def prepare(self, event: Event): def prepare(self, event: Event):
self.framed_image = Image.new('RGB', (event.frame_photo_sized.width, event.frame_photo_sized.height)) self.framed_image = Image.new('RGB', (event.frame_photo_sized.width, event.frame_photo_sized.height))
pos = ((self.framed_image.width - self.photo_image.width) // 2, (self.framed_image.height - self.photo_image.height) // 2) shrinked = shrink_inside(self.photo_image, event.frame_photo_sized.width, event.frame_photo_sized.height).convert('RGBA')
self.framed_image.paste(self.photo_image, pos, self.photo_image.convert('RGBA')) pos = ((self.framed_image.width - shrinked.width) // 2, (self.framed_image.height - shrinked.height) // 2)
self.framed_image.paste(shrinked, pos, shrinked)
self.framed_image.paste(event.frame_photo_sized, (0, 0), event.frame_photo_sized) self.framed_image.paste(event.frame_photo_sized, (0, 0), event.frame_photo_sized)
self.thumb_surface = pil_image_to_surface(shrink_inside(self.framed_image, THUMB_WIDTH, PHOTO_HEIGHT)) self.thumb_surface = pil_image_to_surface(shrink_inside(self.framed_image, THUMB_WIDTH, PHOTO_HEIGHT))