25 lines
509 B
Python
25 lines
509 B
Python
import StarTSPImage
|
|
from PIL import Image, ImageDraw, ImageFont, ImageOps
|
|
import textwrap
|
|
import random
|
|
|
|
def printer(path):
|
|
#432x432
|
|
#34 34
|
|
|
|
432/48
|
|
fr=Image.open("frame.png")
|
|
im=Image.open(path)
|
|
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("./images/test.png") |