automatic printing
first off thanks for this project - it's awesome!
I'm able to take pics using the gpio button press - and then I can print the cartoonified images fine using lp from command line using the format from workflow.py (lp -o landscape -c cartoonX.png) but for some reason they aren't being printed on the gpio button press
i'm new to python - where's a good place to start looking for the problem?
thanks again!
awesome, nice work! Are you using a serial printer? The code isn't set up for USB printers, but it can be done.
If you are using a serial printer, have you enabled the GPIO serial through raspi-config?
I also ran into a similar problem, I am using a serial printer and have enabled the GPIO serial and I can also print from the command line but when I run the program everything seems to work it saves the picture and creates a file with the cartoon image but nothing prints from the printer. If you have any ideas on what could be going wrong that would be awesome
Thanks for getting back! I'm using serial on the printer - the tiny thermal with ttl serial.
I currently have a workaround in place to watch the folder using inotifywait and print using lp when a cartoon*.png file is created in the images directory.
@justfinethanks anyway you could share the code you used as a workaround? I have been looking at this project for a while and still can't get it to print automatically. Thank you
@adammm9 sure thing!
i made a file called "printWatcher.sh" in the pi home folder that uses inotifywait, and then added it to run on startup using crontab. ("crontab -e" from command line to open the file and then adding "@reboot bash /home/pi/printWatcher.sh" to the file.)
printWatcher.sh
#!/bin/bash
inotifywait -m /home/pi/cartoonify/cartoonify/images/ -e create |
while read path action file; do
case "$file" in
(*cartoon*)
echo "Found Cartoon - Waiting for write to finish..."
sleep 1
echo "Slept, Printing ->"
lp -o landscape -c /home/pi/cartoonify/cartoonify/images/"$file"
echo "Printed."
esac
done
sidenote: this script only prints on file creation - i think also a good idea to try to add "-e modify" as well as "-e create" on the inotifywait. I ran into an issue where the files were being overwritten instead of created due to the numerical number scheme so they weren't printing until I cleared the directory. I also have it sleeping for one second after the file is created to finish writing - there's probably a slicker way to achieve this built into inotifywait
@justfinethanks Thanks for the help i got it working!