Converting ESC/P2 output for modern printing

Anything QL Software or Programming Related.
User avatar
tofro
QL Wafer Drive
Posts: 1155
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Converting ESC/P2 output for modern printing

Postby tofro » Wed May 17, 2017 8:28 pm

RWAP wrote: However, making an accurate method of merging the 6 colours (as would happen on an Epson printer) is proving problematic. Can anyone find a C program to convert CMYK to 1 byte RGB (or possibly re-write the cmyk_to_rgb() function in the PrinterConvert.c )?


I'm a bit lost in that function - Why does it try to mix colours? I was under the impression that an Epson printer could print a dot in either black, yellow, magenta or cyan - But not any mix of these. If you wouldn't assume mixing, that function could be close to trivial.

Tobias


Dave
SandySuperQDave
Posts: 1452
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: Converting ESC/P2 output for modern printing

Postby Dave » Wed May 17, 2017 8:43 pm

It can print any and all colours on the same point, sequentially. It's not OR, it's AND/OR. Only the K is opaque, so if it prints K it doesn't print C, M or Y at that point.

To confuse matters further, modern inkjets do variable dot size and fire C, M, Y between 1 and 8 times into each dot. It can calculate the color of a point as "8 yellow, 3 cyan, one magenta and three key firings." If the request is for a higher number of key firings, the color firings are suppressed.

So up to 24 activations of the inkjet nozzles can go into producing a single inkjet point.


Dave
SandySuperQDave
Posts: 1452
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: Converting ESC/P2 output for modern printing

Postby Dave » Wed May 17, 2017 8:44 pm

"between 1 and 8 times" should of course be "between 0 and 8 times"... BUGS!


User avatar
tofro
QL Wafer Drive
Posts: 1155
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Converting ESC/P2 output for modern printing

Postby tofro » Wed May 17, 2017 8:51 pm

After all, Rich is trying to emulate a 1995 Epson printer, not a modern inkjet.

Maybe I'm a little too far on the retro path, but I bet if you'd try 24 times overprinting with a real Epson LQ, you'd be ending up (after waiting a very long time) with a totally messed up ink ribbon and a lot of holes in the paper. (is there a function "create paper jam" on modern printers that would emulate this? ;) )

I also fear (a decent ribbon assumed) if you print a dot 8 times in yellow, it doesn't get any "more yellow" the second and following passes...

Tobias


RWAP
RWAP Master
Posts: 2247
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: Converting ESC/P2 output for modern printing

Postby RWAP » Wed May 17, 2017 9:06 pm

ESC/P2 was aimed at inkjets. Although there are only CMY and K colours to choose from, the set colour control code allows a value anyway of 0 (black), 1 (magenta), 2 (cyan), 3 (violet), 4 (yellow), 5 (red) and 6 (green). These can also be overprinted to give a wide range of colours in the output.

As you say, it is more difficult on an original impact printer (which might have a black, red and blue ribbon) - however, as I am trying to emulate an Epson Stylus Colour 850 inkjet, colour mixing is a necessary evil.

I tried using the simple colour mixing method (add 2 RGB colours together and divide by 2), but they seemed quite a bit different from what I was expecting when comparing stuff I printed on the QL to my old Epson printer (admittedly no longer available for testing).... The convert to CMYK, mix and then convert back to RGB has been based on a routine written by someone else in Python and seems to give better results (but not perfect).

Dave wrote:(5945 * 8417 * 3) / 1024 = 146599K or 144MB. Hmmmm. Then that doesn't sound so bad then :)

Can you assemble multiple page PDFs in RAM? With 1GB RAM on Pi3, maybe 600MB usable, what is your PDF page limit? Or are you treating each page as a separate standalone print job?


We are treating each page as a separate print job because for the retro-printer module, we have no idea when a device sends the end of a multi-page document. Arguably for the public domain version (which is converting a file), we could handle create a multi-page PDF from that one file, but that is the beauty of sharing the code - if someone wants to do that, they can create a fork from the main code which offers this.


User avatar
tofro
QL Wafer Drive
Posts: 1155
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: Converting ESC/P2 output for modern printing

Postby tofro » Wed May 17, 2017 9:30 pm

I was under the impression you'd be looking into the emulation of impact dot matrix printers.

BTW: ESC/P2 with colour support was actually already there before the first inkjets came up. I have a (relatively recent, only some years old) LQ-300+ colour impact printer here that uses a CMYK ribbon. Not even the modern Windows drivers that I never use (The printer is normally connected to my QXL PC) try to mix colours with overprinting (but rather by placing dots next to each other) here.

Tobias


Dave
SandySuperQDave
Posts: 1452
Joined: Sat Jan 22, 2011 6:52 am
Location: Austin, TX
Contact:

Re: Converting ESC/P2 output for modern printing

Postby Dave » Wed May 17, 2017 9:45 pm

He is. The conversation is just focusing on internal processing and output formats right now. Looking at the code, this should be able to accept ESC/P2 for any Epson compatible printer - color or mono.

Do you think this'll run ok on a Pi Zero? (512MB, single core?)


RWAP
RWAP Master
Posts: 2247
Joined: Sun Nov 28, 2010 4:51 pm
Location: Stone, United Kingdom
Contact:

Re: Converting ESC/P2 output for modern printing

Postby RWAP » Thu May 18, 2017 6:41 am

There are a couple of old projects which provide code for ESC/P emulation out there already but they tend to just be black and white printing.

The code I have created sticks to the full ESC/P2 control set, so it can emulate any ESC/P2 printer - it is up to the machine generating the output as to how it uses colour - the ESC/P2 control codes do not differentiate between models in so far as colour is concerned (although that could be done in the firmware I guess). If you could create an output file from the Windows driver for the LQ-300+ (using colour) we could always compare the output when run through the conversion software, but I guess the printer driver does the donkey work to create the adjacent dots in different colours (which should be replicated).

I don't see why the code would not run on the Pi Zero so long as there is enough memory left :)


User avatar
NormanDunbar
Gold Card
Posts: 289
Joined: Tue Dec 14, 2010 9:04 am
Location: Leeds, West Yorkshire, UK
Contact:

Re: Converting ESC/P2 output for modern printing

Postby NormanDunbar » Sat May 20, 2017 8:27 pm

https://www.google.co.uk/url?sa=t&sourc ... J_SVKTn46w might be of use, it covers just about every colours pace conversion known.

It does say that converting from CMYK to ANYTHING is fraught as the colour profiles of the device dependent CMYK data needs to be taken into consideration.

HTH

Cheers,
Norm.


Why do they put lightning conductors on churches?
How come Tarzan never grew a beard?

Return to “Software & Programming”

Who is online

Users browsing this forum: No registered users and 1 guest