label_printer/flask/format_image.py
2024-09-14 20:49:57 +02:00

12 lines
274 B
Python

from PIL import Image
def format_image(path):
image = Image.open(path)
image = image.rotate(-90, expand=True)
new_image = Image.new('1', (512, image.height), 1)
new_image.paste(image, (0, 0))
return new_image
format_image("static/text/text.png")