Should be good
This commit is contained in:
parent
6b905ef5e5
commit
7a0d604a5a
1
Pipfile
1
Pipfile
|
@ -4,7 +4,6 @@ verify_ssl = true
|
|||
name = "pypi"
|
||||
|
||||
[packages]
|
||||
watchgod = "*"
|
||||
startspimage = "*"
|
||||
|
||||
[dev-packages]
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "80445a27b66e2f90d673c21860b4ffd8e3d04ceb76047dc6f5aa29f22e903516"
|
||||
"sha256": "f11632401e12f82dbb06711105eb75c9f08ffa1d6b84536e1c1e41b35432bf5e"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
|
|
5
main.py
5
main.py
|
@ -1,5 +1,10 @@
|
|||
from watchgod import watch
|
||||
from printer import printer
|
||||
|
||||
base = "./"
|
||||
def main():
|
||||
for changes in watch('./images'):
|
||||
print(changes)
|
||||
for change in changes:
|
||||
printer(base + "/" + change[1])
|
||||
|
||||
|
|
18
printer.py
18
printer.py
|
@ -3,15 +3,23 @@ from PIL import Image, ImageDraw, ImageFont, ImageOps
|
|||
import textwrap
|
||||
import random
|
||||
|
||||
def printer():
|
||||
im = Image.new("RGB", (800, 1280), (0, 0, 0))
|
||||
def printer(path):
|
||||
#432x432
|
||||
#34 34
|
||||
|
||||
# im.show()
|
||||
432/48
|
||||
fr=Image.open("frame.png")
|
||||
im=Image.open(path)
|
||||
im = im.resize((432, 432), Image.Resampling.BOX)
|
||||
|
||||
raster = StarTSPImage.imageToRaster(im, cut=True)
|
||||
fr.paste(im, (34,34), im)
|
||||
|
||||
fr.show()
|
||||
|
||||
raster = StarTSPImage.imageToRaster(fr, cut=True)
|
||||
|
||||
printer = open('/dev/usb/lp0', "wb")
|
||||
printer.write(raster)
|
||||
|
||||
if __name__ == "__main__":
|
||||
printer()
|
||||
printer("./images/test.png")
|
Loading…
Reference in New Issue