Commit e3a738b1e534251880fe54c290fe7c488b3cb9ca

Commits
[COMMIT BEGIN]
commit e3a738b1e534251880fe54c290fe7c488b3cb9ca
Author: 0x4248 <[email protected]>
Date:   Mon Feb 16 23:31:19 2026 +0000

    sparkylab: Receipt ESCPOS image experimentation
    
    Signed-off-by: sparkythedoggo

diff --git a/lab/sparkylab/receipt.py b/lab/sparkylab/receipt.py
new file mode 100644
index 0000000..f026d15
--- /dev/null
+++ b/lab/sparkylab/receipt.py
@@ -0,0 +1,27 @@
+#made with Sparky's own 2 paws with a little help from Claude AI
+from PIL import Image
+from escpos import *
+p = printer.Usb(0x08a6, 0x003d, profile ="default")
+
+while True:
+    usertext = input("Enter text to print, enter 'cut' to cut the paper, enter 'exit' to quit: ")
+    if usertext.lower() == 'exit':
+        break
+    elif usertext.lower() == 'cut':
+        for i in range(3):
+            p.text("\n")
+        p.cut()
+    elif usertext.lower() == 'image':
+        p.profile.profile_data['media']['width']['pixels'] = 576  # or 384
+        img = Image.open(input("Enter the path to the image you want to print: "))
+        printer_width = 576
+        aspect_ratio = img.height / img.width
+        new_height = int(printer_width * aspect_ratio)
+        img = img.resize((printer_width, new_height))
+        img = img.convert("1")
+        p.image(img, impl="bitImageColumn")
+        for i in range(3):
+            p.text("\n")
+        p.cut()
+    else:
+        p.text(usertext + "\n")
\ No newline at end of file
[COMMIT END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.