Re: [Gimp-user] Epson i print format (Gutenprint question)

2022-03-01 Thread Gary Aitken

On 3/1/22 1:34 PM, Liam R E Quin wrote:

On Tue, 2022-03-01 at 08:59 -0700, Gary Aitken wrote:

I have a simple image with one straight line of a single color.
Using the gutenprint dialog, I can print that file.
If I do a "reverse translation" of the raw file, there is one escp2
command
in it to print the line, shown below with some notes:


Hello! I'm afraid i'm a little lost here sir - which raw file exactly?
The stream being sent to the printer?  What problem are you trying to
solve exactly?  Why not look at the source code to the driver and/or
the printer specification?


Yeah, I'm probably way more lost than you are...

The file is one generated by gutenprint and sent using the command
"/usr/local/bin/lp -s -d 'printer_name' -oraw" to the cups print system.
So yes, the stream being sent to the printer.

I have been looking at the source, the (outdated) gutenprint docs, and the
(outdated) Epson ESCP2 documentation.  The escp2 documentation discusses
the encoding with examples in terms of full-byte characters, which doesn't
seem like it translates obviously into 2-bit nozzles; unless you assume you
can't treat the input stream as 2 bit chunks.

I need to generate a number of specific output data streams to the printer;
generally regular, single-ink outputs.  I can't get the gutenprint plugin to
do it because it always dithers the output; I don't see any way to turn the
dithering off.  I'm not worried about banding.  If I can understand the
output encoding, I can encode a replacement segment to patch into the output
stream.  Not eloquent, but a means of testing to continue with a project.

FWIW, the hex dump in the original post is from a single pixel pure cyan line
360 pixels long, printed with print quality=manual, media=photo paper, 360x360
resolution, unidirectional, interleave off.

My attempt on the provided data follows:

If I start with the 0xde:

0c0 691b 0112 6802 0101 de00 1200 9a05 6959
esc i 12 01 02 0168 0001  (print command)
count is 0x168 = 360  lines is 0x0001
  data starts at 0c9  de 1200 9a05 6959
  0xde = 222 (negative byte) => 256-222 = 34; + 1 = 35 (repeat count)
next byte = 00 => 35 * {00 00 00 00} => 160 pixels empty space
  0x12 = positive count of 18; + 1 = 19 data bytes following
gets us to 0df
0d0 5999 a565 5999 6566 5996 9695 655a fd56
 fd
  0xfd=253 (neg) => 256-253 = 3; + 1 = repeat 4
next byte (0e0) = 0x66 => 4 * {01 10 01 10}
0e0 1f66 9a59 6656 6566 5996 9665 9659 
  0e1 = 0x1f = 31; + 1 = 32 data bytes following
gets us to 102
0f0 6559  9565 6695 9965 a665  6969
100 5566 95fe 9919 6596 5996 5696 9666 665a
  102 = 0xfe = 254 (neg) => 256-254 = 2; + 1 = repeat 3
 next byte 0x95 => 3 * {10 01 01 01}
 next byte (104) 0x19 = 25; + 1 => 26 data bytes following
   gets us to 11f
110 5956 6669 0456 1044 0041 4110 0040 8140
  11f = 0x81 = 129 (neg) => 256-129 = 127; + 1 = repeat 128
  next byte (120) 0x00 => 128 * {00 00 00 00}
gets us to 121
120 9000 0d00 1b0c 1b40 5228 0008 5200 4d45
  121 = 0x90 = 144 (neg) => 256-144 = 112; + 1 => repeat 113
 next byte (122) 0x00 => 113 * {00 00 00 00}
   gets us to 123

That uses up 360 bytes of output data, which matches the count.
  (35 + 19 + 4 + 32 + 3 + 26 + 128 + 113 = 360)
Unfortunately, we're left with 1 byte, 0x0d, left-over.
The next command in the print stream is actually the 0x0c (FF) at 124.

Any insights would be much appreciated,

Gary
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list


Re: [Gimp-user] Epson i print format (Gutenprint question)

2022-03-01 Thread Liam R E Quin
On Tue, 2022-03-01 at 08:59 -0700, Gary Aitken wrote:
> I have a simple image with one straight line of a single color.
> Using the gutenprint dialog, I can print that file.
> If I do a "reverse translation" of the raw file, there is one escp2
> command
> in it to print the line, shown below with some notes:

Hello! I'm afraid i'm a little lost here sir - which raw file exactly?
The stream being sent to the printer?  What problem are you trying to
solve exactly?  Why not look at the source code to the driver and/or
the printer specification?

ankh / demib0y


-- 
Liam Quin - https://www.fromoldbooks.org/

Full-time "slave" in voluntary servitude

___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list


Re: [Gimp-user] Epson i print format (Gutenprint question)

2022-03-01 Thread Gary Aitken

On 3/1/22 8:59 AM, Gary Aitken wrote:

I have a simple image with one straight line of a single color.
Using the gutenprint dialog, I can print that file.
If I do a "reverse translation" of the raw file, there is one escp2 command
in it to print the line, shown below with some notes:

006a  1b  (  U 05 00 08 08 08 40 0b
     units; (page1=08), (vt1=08), (hz1=08), (base2= 40 0b = 0xb40 = 2880)
...
00c0  1b  i 12 01 02 68 01 01 00
     Print color1, compress1, bits1, bytes2, lines2, data...
     color1 = 0x12 = 18 = light cyan
     compress1 = 1 (TIFF compression)
     bits1 (bits/pixel) = 0x2 = 2
     bytes2 =  = 0x068 = 360
     lines2 is # lines to print = 0x0001 = 1
     data = unknown, not dumped; specifies the dot size, 2 bits each
0124  0c
     FF

What I don't understand is what bytes2 is counting.
There are 100 bytes between 00c0 and 0124.
What does the 360 mean?
Do the horizontal units factor or the compression type factor into this
in some way?


My oversight, I see the bytes2 is a count of pixels in each line.
But the question remains:


How do you compute where the next command (the FF) is?


Do you have to actually decode the tiff data?
The data doesn't look like tiff (I don't know squat about tiff), but aren't
the first two bytes of tiff supposed to be "II" or "MM" describing little/big
endian format?  And this data starts with 0xde:


The actual data, not shown above, looks like this:

0c0 691b 0112 6802 0101 de00 1200 9a05 6959
  i esc   de   ... more data
0d0 5999 a565 5999 6566 5996 9695 655a fd56
0e0 1f66 9a59 6656 6566 5996 9665 9659 
0f0 6559  9565 6695 9965 a665  6969
100 5566 95fe 9919 6596 5996 5696 9666 665a
110 5956 6669 0456 1044 0041 4110 0040 8140
120 9000 0d00 1b0c 1b40 5228 0008 5200 4d45
     FF

___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list


[Gimp-user] Epson i print format (Gutenprint question)

2022-03-01 Thread Gary Aitken

I have a simple image with one straight line of a single color.
Using the gutenprint dialog, I can print that file.
If I do a "reverse translation" of the raw file, there is one escp2 command
in it to print the line, shown below with some notes:

006a  1b  (  U 05 00 08 08 08 40 0b
units; (page1=08), (vt1=08), (hz1=08), (base2= 40 0b = 0xb40 = 2880)
...
00c0  1b  i 12 01 02 68 01 01 00
Print color1, compress1, bits1, bytes2, lines2, data...
color1 = 0x12 = 18 = light cyan
compress1 = 1 (TIFF compression)
bits1 (bits/pixel) = 0x2 = 2
bytes2 =  = 0x068 = 360
lines2 is # lines to print = 0x0001 = 1
data = unknown, not dumped; specifies the dot size, 2 bits each
0124  0c
FF

What I don't understand is what bytes2 is counting.
There are 100 bytes between 00c0 and 0124.
What does the 360 mean?
Do the horizontal units factor or the compression type factor into this
in some way?
How do you compute where the next command (the FF) is?

The actual data, not shown above, looks like this:

0c0 691b 0112 6802 0101 de00 1200 9a05 6959
 i esc   de   ... more data
0d0 5999 a565 5999 6566 5996 9695 655a fd56
0e0 1f66 9a59 6656 6566 5996 9665 9659 
0f0 6559  9565 6695 9965 a665  6969
100 5566 95fe 9919 6596 5996 5696 9666 665a
110 5956 6669 0456 1044 0041 4110 0040 8140
120 9000 0d00 1b0c 1b40 5228 0008 5200 4d45
FF

Gary
___
gimp-user-list mailing list
List address:gimp-user-list@gnome.org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list