Lexmark XS950 Printer Languages and Interfaces Technical Reference - Page 38

Group 3 and group 4 raster compression, 02 0002'x 'F9FF 'x, b1002M, r256S, b9645W

Page 38 highlights

Printer Control Language (PCL) emulation 38 '02 0002'x 'F9FF 'x ESC*rB |TIFF: 8x'FF'x |End graphics Zlib Zlib is a generic compression method. It refers to a standard for compression and the library that implements the standard. The zlib compression method uses the deflate algorithm. This same algorithm is used by more widely known compression utilities such as PKZIP and GZIP. Compressed data is a series of variably sized blocks. An encoder determines how to break the data into blocks and finds the best compression method to use for each block. An encoder works based on the following principles: • The encoder creates a dictionary containing different characters in a set of data. Short strings of bits represent more commonly occurring characters, and long strings of bits represent less frequently used characters. • A probability tree determines which characters are frequently used. • Repeated patterns in a string of characters are identified and stored to avoid storing the string multiple times. A three-bit zlib header is added to the beginning of a block to describe the type of compression used. The header also indicates whether the block is a final block. Other information in the header includes checksums, compression algorithm used, and the level of compression. In compression, all checksums are set to zero, and in decompression, the checksums are ignored. The memory required for zlib compression and decompression is independent of the size of the data for compression or decompression. The number 999 is used to represent zlib compression because it does not conflict with other compression types. Group 3 and group 4 raster compression Since group 4 images do not use line endings, the width of the image must be specified using the Raster Width command (ESC*r#S). Send the compressed image data to the printer using the Transfer Raster Data command (ESC*b#W). The maximum number of bytes that can be sent using the command is 32K bytes. Break up images larger than 32K bytes and send them using multiple commands. It does not matter where the image is broken, or how many Transfer Raster Data commands are used. When the image is started (with a Transfer Raster Data command), no other commands are allowed until the entire image has been sent. The following example prints a group 4 image file that is 256 bits wide and 9,645 bytes long: ESC*b1002M ESC*r256S ESC*r1A ESC*b9645W ...[Group 4 image data]... ESC*rB |Set raster compression to group 4 |Define width of image in input bits |Start raster graphics at current position |9,645 bytes of a group 4 image |End raster graphics

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148

'02 0002'x 'F9FF 'x
|TIFF: 8x'FF'x
ESC
*rB
|End graphics
Zlib
Zlib is a generic compression method. It refers to a standard for compression and the library that implements
the standard.
The zlib compression method uses the deflate algorithm. This same algorithm is used by more widely known
compression utilities such as PKZIP and GZIP.
Compressed data is a series of variably sized blocks. An encoder determines how to break the data into blocks
and finds the best compression method to use for each block.
An encoder works based on the following principles:
The encoder creates a dictionary containing different characters in a set of data. Short strings of bits
represent more commonly occurring characters, and long strings of bits represent less frequently used
characters.
A probability tree determines which characters are frequently used.
Repeated patterns in a string of characters are identified and stored to avoid storing the string multiple
times.
A three-bit zlib header is added to the beginning of a block to describe the type of compression used. The
header also indicates whether the block is a final block. Other information in the header includes checksums,
compression algorithm used, and the level of compression. In compression, all checksums are set to zero, and
in decompression, the checksums are ignored.
The memory required for zlib compression and decompression is independent of the size of the data for
compression or decompression.
The number 999 is used to represent zlib compression because it does not conflict with other compression
types.
Group 3 and group 4 raster compression
Since group 4 images do not use line endings, the width of the image must be specified using the Raster Width
command (
ESC
*r#S
).
Send the compressed image data to the printer using the Transfer Raster Data command (
ESC
*b#W
). The
maximum number of bytes that can be sent using the command is 32K bytes. Break up images larger than 32K
bytes and send them using multiple commands. It does not matter where the image is broken, or how many
Transfer Raster Data commands are used. When the image is started (with a Transfer Raster Data command),
no other commands are allowed until the entire image has been sent.
The following example prints a group 4 image file that is 256 bits wide and 9,645 bytes long:
ESC
*b1002M
|Set raster compression to group 4
ESC
*r256S
|Define width of image in input bits
ESC
*r1A
|Start raster graphics at current position
ESC
*b9645W
|9,645 bytes of a group 4 image
...
[Group 4 image data]
...
ESC
*rB
|End raster graphics
Printer Control Language (PCL) emulation
38