label_printer/flask/format_image.py

13 lines
294 B
Python
Raw Normal View History

2024-09-14 18:49:57 +00:00
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
2024-09-15 10:20:53 +00:00
#format_image("static/text/text.png").save("output.png")