escpos-php icon indicating copy to clipboard operation
escpos-php copied to clipboard

TM-T88III - Strange issue with dithered image (see photos)

Open DOCaCola opened this issue 3 years ago • 6 comments

I experience a strange issue when trying to print more "complex" images. I have attached two image files, one is a dithered version and one is a non-dithered version. The non-dithered version seems to print fine every time, while the dithered version is distorted. I have attached photos of the result.

IMG_4105 IMG_4106

My setup: I have a TM-T88III connected to a raspberry pi via usb-serial adapter. The graphics library being used should be imagemagick. I have to use bitImage() since graphics() doesn't seem to be working.

Here is the relevant code.

$connector = new FilePrintConnector("/dev/serial/by-id/usb-067b_2303-if00-port0"); $profile = CapabilityProfile::load("TM-T88III");
$printer = new Printer($connector, $profile); $printer -> initialize(); $tux = EscposImage::load('dithered.png', false); $printer -> bitImage($tux, Printer::IMG_DOUBLE_WIDTH | Printer::IMG_DOUBLE_HEIGHT); $printer -> feed(); $printer -> cut(); $printer -> close();

notdithered dithered

DOCaCola avatar Jul 25 '21 19:07 DOCaCola

I did some more testing. Using the 'native' image library results in the exact same issue. I also cropped the dithered tux image at the top and the same split in the head appears as when i print the uncropped version.

ditheredcropped IMG_4107

DOCaCola avatar Jul 25 '21 23:07 DOCaCola

I have output the data generated by escpos-php to a file. What is being sent to the printer appears to be correct. My TM-T88III has a native serial port connected via an usb to rs232 adapter. I have tried changing the printer speed between 19200 and 9600 with no difference to what is being printed. Either the printer doesn't interpret the data right or it is some kind of strange issue with the USB-RS232 adapters. I tested two Adapters with an Prolific and a FTDI (genuine) chipset both showing exact the same output.

Hex Workshop -  Z: private tmp printoutput txt  2021-07-26 22-49-03

DOCaCola avatar Jul 26 '21 20:07 DOCaCola

I tested with bitImageColumnFormat. Even there, there are issues when instructing EscposImage to generate a dithered image.

$tux = EscposImage::load('tux.png', false); $printer -> bitImageColumnFormat($tux); prints fine

$tux = EscposImage::load('tux.png', true); $printer -> bitImageColumnFormat($tux); garbled output IMG_4108 This is the tux.png i used as input: Tux

DOCaCola avatar Jul 27 '21 10:07 DOCaCola

I produced an image with 2 pixels height that still give me the pixel shift issue. I will attach it to this post along with the raw output from escpos-php. pixeltest Archiv.zip

DOCaCola avatar Jul 28 '21 08:07 DOCaCola

Did you ever figure out how to fix this?

Devetec avatar Dec 11 '23 22:12 Devetec

Not really. I have upgraded to a TM-T88V which supports the "graphics" function which works unlike "bitImage" function. Maybe in bitImage mode the data needs some additional escaping when certain bitmap sequences are sent to the printer. The printer might interpret some of these bitmap sequences as some other command. Probably looking at the output of the old official windows drivers would be worth a shot for this. Comparing what they send over rs232 compared to escpos-php

DOCaCola avatar Dec 11 '23 22:12 DOCaCola