From c99665041485b29e88f5ca589ab7d2af9ef2fec6 Mon Sep 17 00:00:00 2001 From: jimmy Date: Wed, 21 Sep 2022 00:51:44 +1200 Subject: [PATCH] What happens when you don't have a pen --- printer/press.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 printer/press.py diff --git a/printer/press.py b/printer/press.py new file mode 100644 index 0000000..3c5b6d6 --- /dev/null +++ b/printer/press.py @@ -0,0 +1,28 @@ +import StarTSPImage +from PIL import Image, ImageDraw, ImageFont, ImageOps +import textwrap +import random + +im = Image.new('RGB', (500, 1600), color = 'white') +# f = ImageFont.load_default() +f = ImageFont.truetype("printer/SilkRemington-Regular.otf", 100) +txt=Image.new('L', (1600,500)) +d = ImageDraw.Draw(txt) + + + + + + + +d.text((50, 50), "(When flashing)", font=f, fill=255) +w=txt.rotate(-90, expand=1) + +im.paste( ImageOps.colorize(w, (0,0,0), (0,0,0)), (-100, 60), w) + +im.show() +# im.save("image_tmp.jpg") + +raster = StarTSPImage.imageToRaster(im, cut=True) +printer = open('/dev/usb/lp0', "wb") +printer.write(raster) \ No newline at end of file