Initial commit

This commit is contained in:
2025-11-14 22:47:27 +00:00
commit 5a842158ad
50 changed files with 124762 additions and 0 deletions

124456
junk/t8.shakespeare.txt Normal file

File diff suppressed because it is too large Load Diff

36
junk/test.py Normal file
View File

@@ -0,0 +1,36 @@
from escpos.printer import Network
from PIL import Image
import os
def resize_image_to_fullwidth(img_src_name, target_width=580):
# Open the image
img = Image.open(img_src_name)
# Get original dimensions
width, height = img.size
# Calculate new height to maintain aspect ratio
aspect_ratio = height / width
new_height = int(target_width * aspect_ratio)
# Resize the image
resized_img = img.resize((target_width, new_height), Image.LANCZOS)
# Save the resized image
name, ext = os.path.splitext(img_src_name)
# Build destination filename
dest_name = f"{name}_fullwidth{ext}"
resized_img.save(dest_name)
return dest_name
# Replace with your printer's IP address and port
p = Network("192.168.192.168", port=9100)
# Example printing
# p.set_with_default(align='center', font='a', bold=False, width=2, height=2, custom_size=True, smooth=True)
p.textln("Thanks babes")
img_names = ["img/1754661985256965s.jpg", "img/1754658917785283.png"]
img_name = resize_image_to_fullwidth(img_names[1])
p.image(img_name, impl='graphics');
# p.image("img/" + img_names[1], impl='bitImageColumn', center=True, high_density_horizontal=False, high_density_vertical=False);
p.cut()