Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stickersbeter #20

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
nu ook met large
meneerhenk committed Nov 22, 2024
commit a47a95a3142068af17bb2bf62e93fd20155e08d7
30 changes: 29 additions & 1 deletion plugins/stickers.py
Original file line number Diff line number Diff line change
@@ -3,6 +3,7 @@
import json
import re
import io
import time
import base64
import urllib
from PIL import Image, ImageDraw, ImageFont
@@ -93,6 +94,28 @@ def barcodeprint(self):
)
self.realprint(img)

def foodprint(self):
img = Image.new("RGB", self.SMALL, self.WHITE)
draw = ImageDraw.Draw(img)

# Load the logo
LOGO = Image.open(self.LOGOFILE)
LOGO = LOGO.resize(
self.LOGOSMALLSIZE, resample=Image.LANCZOS # pylint: disable=no-member
)

# Paste the logo onto the image
img.paste(LOGO, (0, 0))

# Load a font
font = ImageFont.truetype(self.FONT, 40)

# Add text
draw.text((0, self.SMALL[1] - 15), self.name, fill=self.BLACK, font=font)
font = ImageFont.truetype(self.FONT, 50)
draw.text((320, 120), time.strftime("%Y-%m-%d"), fill=self.BLACK, font=font)
self.realprint(img)

def thtprint(self):
# Create an image
img = Image.new("RGB", self.SMALL, self.WHITE)
@@ -221,7 +244,12 @@ def eigendomprint(self):
draw.text((650, mystep - 1), "☐", fill=self.BLACK, font=font)
draw.text((651, mystep - 0), "☐", fill=self.BLACK, font=font)
if self.large:
# TODO: resize
scale = self.SMALL[0] / self.SMALL[1]
img = img.resize(
int(self.SMALL[0] * scale),
int(self.SMALL[1] * scale),
Image.Resampling.LANCZOS,
)
self.realprint(img, rotate="90", copies=int(self.copies))
else:
self.realprint(img, copies=int(self.copies))