HP (Hewlett-Packard) PCL Photo Scanner User Manual


 
EN Set Compression Method Command 15-17
Tagged Image File Format Encoding
(Method 2)
Tagged image file format encoding interprets raster data as TIFF
“Packbits.” This format combines features of methods 0 and 1. A
control byte precedes the raster data (pattern bytes). The control
byte identifies whether the pattern byte(s) represent a byte that is to
be repeated some number of times (up to 127), or represent some
number of bytes (up to 127) which are to be printed as is (literal).
The sign of the number in the control byte identifies whether the byte
or bytes that follow represent a literal pattern or byte to be repeated.
A positive number (1 to 127) indicates that the bytes are literal. A
negative number (-1 to -127), represented by the twos complement,
indicates a repeated byte. The value of the number, if positive (literal),
identifies the number of pattern bytes which follow the control byte;
if negative (repeated), identifies the number of times to repeat the
following byte. A pattern byte may be repeated up to 127 times; or
up to 127 literal bytes may follow the control byte.
As mentioned, for a byte to be repeated, the control byte must be a
negative value as represented by the twos complement. For example,
to repeat a pattern three times would require the twos complement of
the number 3. The twos complement is computed as follows. The
binary of 3 is 00000011. Complement each bit to get 11111100, then
add one to this value to produce 11111101, the twos complement.
The decimal value of this number, 253, used in the control byte,
produces a repetition of 3 bytes for a total of 4 occurrences of the
pattern.