label_printer/flask/format_image.py
2024-09-15 12:26:17 +02:00

12 lines
294 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").save("output.png")