shrinking photo inside frame now
This commit is contained in:
parent
4176c473e3
commit
8f091c8831
@ -150,8 +150,7 @@ class Fotobox:
|
||||
self._printer.qr(self._choice.urlWithProtocol, center=True, size=5)
|
||||
self._printer.text(url + "\n")
|
||||
self._printer.text("/p/" + self._choice.code + "\n")
|
||||
self._printer.text(" \n")
|
||||
self._printer.text(" \n")
|
||||
self._printer.cut()
|
||||
self._printed = True
|
||||
|
||||
except Exception as e:
|
||||
|
||||
5
Photo.py
5
Photo.py
@ -21,8 +21,9 @@ class Photo:
|
||||
|
||||
def prepare(self, event: Event):
|
||||
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)
|
||||
self.framed_image.paste(self.photo_image, pos, self.photo_image.convert('RGBA'))
|
||||
shrinked = shrink_inside(self.photo_image, event.frame_photo_sized.width, event.frame_photo_sized.height).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.thumb_surface = pil_image_to_surface(shrink_inside(self.framed_image, THUMB_WIDTH, PHOTO_HEIGHT))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user