From 2a81b7efdea797a9b68701d4c47d62488f569fef Mon Sep 17 00:00:00 2001 From: TT-392 Date: Sat, 14 Sep 2024 15:29:58 +0200 Subject: [PATCH] Working gen_image --- flask/ComicMono.ttf | Bin 0 -> 18724 bytes flask/gen_image.py | 30 ++++++++++++++++++++++++++++++ flask/printer_info.py | 1 + 3 files changed, 31 insertions(+) create mode 100644 flask/ComicMono.ttf create mode 100644 flask/gen_image.py create mode 100644 flask/printer_info.py diff --git a/flask/ComicMono.ttf b/flask/ComicMono.ttf new file mode 100644 index 0000000000000000000000000000000000000000..9bc7354e3ad1702a85a08dea067bb2871bce689a GIT binary patch literal 18724 zcma*P2Y6i7wFY|jK4qGw_mQUeqS5pjwNdY~ie<@?EZef>CR?&xk+MTfOg_&%pjeh)%ypLNnwHd}eL{ZaIOz+Gm&72heGQyG7)cF)E?2~sQ z;aIh>4?|{#&~Z4+;KLXsM77PlqD63_V)mMIFTyy_?R0c@G*H!)!{K87!tbPh&6VLT za89^}{(!j(wjC6Lk!>aKAR{DCbQl#;T51vHr5xx*WTL*LV$^9=Nqvb9Q#I5O)lBtL zhp8TF4b?%-r*c#)x)=3QPQ}9f{XJ)8Msu7;e@HYxa z-IN;kVzBiVRZhJLuL)$MhN($v6ux5|)@PF1Of91(V5=FwI0q-z*7y+ zMtH{r`T+L*FopzLingPb)E}rX&?rm`bVzs>&CDCdPYYW`6a%uMr~+ZN7;2|O=dd`e z4j1Sh$i<;`m>fl9Z~DXcJKt}AzwP~|*-wDeGYckJsl91ViCSakL~BPb5?6Og2|qR$ft=ud1%8tpm$x zYHn$5YoF86+0{L_XI^jL{QiN#1w#uLEgoL-!*Bb4-zIYS|M^%tvU1h3i*l^&l$_{7x2)H`C=KmK#AsF7TY4o|;?-{QKdLeN6+LfB~F zj0)s;`LcQ1A4PeT&ZA_;Ky$uyDwE9^^g0gzT+J|I%;v+vG($^inxzrV;?htgwV`cz zw6=M$pZ!?NORu@2ytX)rvk6)lK4f#Qu9;~e)o)DuVdOK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mf98Eo>#d5) zOAKzcRs?r6yE6fEA_nv(jQKR;>3i{A6wtp~a_hwR)Z*W-KzCZ9FKWJfBx6$}z)9lUXv9Rk@Mc0vBD9qL6u-d!3Hru? zlLSaIKWoZ}MT{9f3O;K) zeJg$odOp>#gTIq8I6;EO@b8AxmM(`kZg#IS7sL`Kn~NRb|2`aZsWe03$`2ZfOpHuU zmJ6+K!9b{~n`UCw2y_qYAc>=cnk(okK;Qvhij{h}zr^n4d{%^9el?)jB12(z+L+@qoC@@I~{Z2ofLe{1bi(S0{n1H$Ha#5 zCGgrPTsbMcZh+Y?hj%AnrZIRegXfQZ>dcue%rOJc1Y8>@7`hRL);O_Y<#IM)eXJoJ;2oVQho3n zHvQB9HApRh--cNTzk9Qo8iwV(hq{+~fO?R6nz|2u)#jiuHw3>8g9U3Lg+P;VjO^1O fRs^#p{){{XnLNAv!QYUb-|hNM2YDsG74-iAi_5QO literal 0 HcmV?d00001 diff --git a/flask/gen_image.py b/flask/gen_image.py new file mode 100644 index 0000000..e63e78c --- /dev/null +++ b/flask/gen_image.py @@ -0,0 +1,30 @@ +from PIL import Image, ImageDraw, ImageFont +from colorama import Fore, Style +from printer_info import * + +def gen_image(height, string1, string1_size, string1_pos, string2, string2_size, string2_pos, justification): + font1 = ImageFont.truetype("ComicMono.ttf", size=string1_size) + font2 = ImageFont.truetype("ComicMono.ttf", size=string2_size) + + text1_box = font1.getbbox(string1) + text2_box = font2.getbbox(string2) + + text1_width = text1_box[2] + text2_width = text2_box[2] + + # I am assuming the left corner of the bbox to always be 0, I have yet to + # encounter a situation when this isn't the case + if (text1_box[0] != 0 or text2_box[0] != 0): + print(Fore.YELLOW + "Warning, found situation where left corner of bbox of text != 0,", "text1_box:", text1_box, "text2_box", text2_box) + + + img = Image.new('1', (max(text1_width, text2_width), height), color=1) + + draw = ImageDraw.Draw(img) + + draw.text((0, string1_pos), string1, font=font1) + draw.text((0, string2_pos), string2, font=font2) + + return img + +gen_image(label_width, "faf", 30, 10, "Hello world", 20, 40, justification="left").save('output.png') diff --git a/flask/printer_info.py b/flask/printer_info.py new file mode 100644 index 0000000..2da3a4e --- /dev/null +++ b/flask/printer_info.py @@ -0,0 +1 @@ +label_width = 100