2022-11-04 01:51:04 +00:00
|
|
|
import StarTSPImage
|
|
|
|
from PIL import Image, ImageDraw, ImageFont, ImageOps
|
|
|
|
import textwrap
|
|
|
|
import random
|
|
|
|
|
2022-11-04 11:41:07 +00:00
|
|
|
def printer():
|
2022-11-04 09:22:56 +00:00
|
|
|
fr=Image.open("frame.png")
|
2022-11-04 11:41:07 +00:00
|
|
|
im=Image.open("image.png")
|
2022-11-04 09:22:56 +00:00
|
|
|
im = im.resize((432, 432), Image.Resampling.BOX)
|
2022-11-04 01:51:04 +00:00
|
|
|
|
2022-11-04 09:22:56 +00:00
|
|
|
fr.paste(im, (34,34), im)
|
|
|
|
|
2022-11-04 11:41:07 +00:00
|
|
|
#fr.show()
|
2022-11-04 09:22:56 +00:00
|
|
|
|
|
|
|
raster = StarTSPImage.imageToRaster(fr, cut=True)
|
2022-11-04 01:51:04 +00:00
|
|
|
|
|
|
|
printer = open('/dev/usb/lp0', "wb")
|
|
|
|
printer.write(raster)
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2022-11-04 11:41:07 +00:00
|
|
|
printer()
|