Open pkronstrom opened 5 years ago
Hello,
Thank you very much for the report :)
I never had this kind of issue. Is it OK to send me an image that is problematic?
Do you see the issue everytime on a given picture or is it just random?
Hello,
I'm having the exact same issue, with any images.
I send 384px wide pictures, in 1bit. Usually, it starts with missing/miss-aligned rows and then I get some kind of buffer overflow with junk characters printed.
My printer is at the default 19200 baud rate. It is a cheap Ada Fruit Mini Thermal Printer.
Thanks
@aleray could you post your code and the picture you are trying to print please?
Hello @BoboTiG here is my code.
import sys
from PIL import Image
from thermalprinter import *
with ThermalPrinter(port='/dev/ttyUSB0') as printer:
for img in sys.argv[1:]:
printer.image(Image.open(img))
And the image
Thanks, I will have a look when possible (likely this week-end).
@BoboTiG Thanks.
In the meanwhile I tested https://github.com/adafruit/Python-Thermal-Printer and it seems to be working properly, although the code is not well packaged and it might be Python 2 only.
Have a look at their source code, they extensively commented it and they talk about a few trick to avoid buffer overflows.
I'm also getting this issue. Sometimes its the buffer overflow, sometimes its just missing lines in the image. Any update on this?
I will have a look this week, sorry for the inconvenience :)
Do you have Python error or something I can use to reproduce? Perhaps could you post the entire Python code and a faulty picture?
OK I tried something but without success. I will check later (I need to find time). If anyone wants to give a hand, help is very welcome :)
Greetings! Thank you for this awesome library!
I've been wondering for a while the reason why I occasionally get corrupted images (missing rows, or rows not aligned correctly). Sometimes the image printing gets halted and the printer starts spewing out random characters.
I looked into your code and noticed that the image printing script sleeps for a short amount of time for each chunk's row. This is dependant on the printer's baudrate.
See https://github.com/BoboTiG/thermalprinter/blob/master/thermalprinter/thermalprinter.py#L418 and https://github.com/BoboTiG/thermalprinter/blob/master/thermalprinter/thermalprinter.py#L53
I managed to get my images working by setting a hardcoded self._byte_Time 0.0005 (which is somewhat close to the default timing) rather than depending on the low sleep time set by my higher baudrate 115200.
Just to let you know! Thanks again!
Upvote & Fund