kac/printer.py

21 lines
458 B
Python

import StarTSPImage
from PIL import Image, ImageDraw, ImageFont, ImageOps
import textwrap
import random
def printer():
fr=Image.open("frame.png")
im=Image.open("image.png")
im = im.resize((432, 432), Image.Resampling.BOX)
fr.paste(im, (34,34), im)
#fr.show()
raster = StarTSPImage.imageToRaster(fr, cut=True)
printer = open('/dev/usb/lp0', "wb")
printer.write(raster)
if __name__ == "__main__":
printer()