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"
|
name = "pypi"
|
||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
watchgod = "*"
|
|
||||||
startspimage = "*"
|
startspimage = "*"
|
||||||
|
|
||||||
[dev-packages]
|
[dev-packages]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"_meta": {
|
"_meta": {
|
||||||
"hash": {
|
"hash": {
|
||||||
"sha256": "80445a27b66e2f90d673c21860b4ffd8e3d04ceb76047dc6f5aa29f22e903516"
|
"sha256": "f11632401e12f82dbb06711105eb75c9f08ffa1d6b84536e1c1e41b35432bf5e"
|
||||||
},
|
},
|
||||||
"pipfile-spec": 6,
|
"pipfile-spec": 6,
|
||||||
"requires": {
|
"requires": {
|
||||||
|
|
5
main.py
5
main.py
|
@ -1,5 +1,10 @@
|
||||||
from watchgod import watch
|
from watchgod import watch
|
||||||
|
from printer import printer
|
||||||
|
|
||||||
|
base = "./"
|
||||||
def main():
|
def main():
|
||||||
for changes in watch('./images'):
|
for changes in watch('./images'):
|
||||||
print(changes)
|
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 textwrap
|
||||||
import random
|
import random
|
||||||
|
|
||||||
def printer():
|
def printer(path):
|
||||||
im = Image.new("RGB", (800, 1280), (0, 0, 0))
|
#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 = open('/dev/usb/lp0', "wb")
|
||||||
printer.write(raster)
|
printer.write(raster)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
printer()
|
printer("./images/test.png")
|
Loading…
Reference in New Issue