On 3/1/22 14:00, Gary Aitken wrote:
> 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:
>>
>> 0000006a  1b  (  U 05 00 08 08 08 40 0b
>>          units; (page1=08), (vt1=08), (hz1=08), (base2= 40 0b = 0xb40 = 2880)
>> ...
>> 000000c0  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
>> 00000124  0c
>>          FF
>>
>> What I don't understand is what bytes2 is counting.
>> There are 100 bytes between 000000c0 and 00000124.
>> 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?

Yes you do.  It's basically a simple RLE compression scheme.  Repeated bytes 
(up to 128) are
represented as

[1-N][byte]

Non-repeated sequences (up to 128 bytes) are output as

[N][sequence]

It is possible for the "compression" to expand the data some; there's a very 
hairy calculation for
the worst case.
_______________________________________________
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

Reply via email to