| 1 |
|
| 2 |
JBIG-KIT lossless image compression library |
| 3 |
------------------------------------------- |
| 4 |
|
| 5 |
by Markus Kuhn |
| 6 |
|
| 7 |
|
| 8 |
The latest release of JBIG-KIT can be downloaded from |
| 9 |
|
| 10 |
http://www.cl.cam.ac.uk/~mgk25/jbigkit/ |
| 11 |
|
| 12 |
JBIG-KIT implements a highly effective data compression algorithm for |
| 13 |
bi-level high-resolution images such as fax pages or scanned |
| 14 |
documents. |
| 15 |
|
| 16 |
JBIG-KIT provides two variants of a portable library of compression |
| 17 |
and decompression functions with a documented interface. You can very |
| 18 |
easily include into your image or document processing software. In |
| 19 |
addition, JBIG-KIT provides ready-to-use compression and decompression |
| 20 |
programs with a simple command line interface (similar to the |
| 21 |
converters found in Jef Poskanzer's PBM graphics file conversion |
| 22 |
package). |
| 23 |
|
| 24 |
JBIG-KIT implements the specification |
| 25 |
|
| 26 |
International Standard ISO/IEC 11544:1993 and ITU-T Recommendation |
| 27 |
T.82(1993), "Information technology - Coded representation of picture |
| 28 |
and audio information - progressive bi-level image compression", |
| 29 |
<http://www.itu.int/rec/T-REC-T.82>, |
| 30 |
|
| 31 |
which is commonly referred to as the "JBIG1 standard". JBIG (Joint |
| 32 |
Bi-level Image experts Group) is the committee which developed this |
| 33 |
international standard for the lossless compression of images using |
| 34 |
arithmetic coding. Like the well-known compression algorithms JPEG and |
| 35 |
MPEG, JBIG has also been developed and published by the International |
| 36 |
Organization for Standardization (ISO) and the International |
| 37 |
Telecommunication Union (ITU). See also |
| 38 |
|
| 39 |
http://www.jpeg.org/jbig/ |
| 40 |
http://www.iso.ch/ |
| 41 |
http://www.itu.int/ |
| 42 |
|
| 43 |
The JBIG compression algorithm offers the following features: |
| 44 |
|
| 45 |
- Close to state-of-the-art lossless compression ratio for high |
| 46 |
resolution bi-level images. |
| 47 |
|
| 48 |
- About 1.1 to 1.5 times better compression ratio on typical |
| 49 |
scanned documents compared to G4 fax compression (ITU-T T.6), |
| 50 |
which has been the best compression algorithm for scanned |
| 51 |
documents available prior to JBIG. |
| 52 |
|
| 53 |
- Up to 30 times better compression of scanned images with dithered |
| 54 |
images compared to G4 fax compression. |
| 55 |
|
| 56 |
- About 2 times better compression on typical 300 dpi documents |
| 57 |
compared to 'gzip -9' on raw bitmaps. |
| 58 |
|
| 59 |
- About 3-4 times better compression than GIF on typical 300 dpi |
| 60 |
documents. |
| 61 |
|
| 62 |
- Even much better competitive compression results on computer |
| 63 |
generated images which are free of scanning distortions. |
| 64 |
|
| 65 |
- JBIG supports hierarchical "progressive" encoding, that means it is |
| 66 |
possible to encode a low resolution image first, followed by |
| 67 |
resolution enhancement data. This allows, for instance, a document |
| 68 |
browser to display already a good 75 dpi low resolution version of |
| 69 |
an image, while the data necessary to reconstruct the full 300 dpi |
| 70 |
version for laser printer reproduction is still arriving (say |
| 71 |
over a slow network link or mass storage medium). |
| 72 |
|
| 73 |
- The various resolution layers of a JBIG image in progressive |
| 74 |
encoding mode together require not much more space than a |
| 75 |
normal non-progressive mode encoded image (which JBIG also |
| 76 |
supports). |
| 77 |
|
| 78 |
- The progressive encoding mode utilizes a quite sophisticated |
| 79 |
resolution reduction algorithm which offers high quality low |
| 80 |
resolution versions that preserve the shape of characters as well |
| 81 |
as the integrity of thin lines and dithered images. |
| 82 |
|
| 83 |
- JBIG supports multiple bit planes and can this way also be used |
| 84 |
for grayscale and color images, although the main field of |
| 85 |
application is compression of bi-level images, i.e. images with |
| 86 |
only two different pixel values. For grayscale images with up to |
| 87 |
6 bit per pixel, JBIG performs superior to JPEG's lossless |
| 88 |
mode. |
| 89 |
|
| 90 |
JBIG-KIT can be used as free software under the GNU General Public |
| 91 |
License. Other license arrangements more suitable for commercial |
| 92 |
applications are available as well, please contact the author for |
| 93 |
details. JBIG-KIT provides two portable libraries implemented in |
| 94 |
ANSI/ISO C for encoding and decoding JBIG data streams, along with |
| 95 |
documentation. The first library, jbig.c, implements nearly all of the |
| 96 |
options that the JBIG standard provides, but keeps the entire |
| 97 |
uncompressed image in memory. The second library, jbig85.c, implements |
| 98 |
only the ITU-R T.85 subset of the standard that black/white fax |
| 99 |
machines use (single bit per pixel, no "progressive" encoding), and |
| 100 |
keeps only three lines of the uncompressed image in memory, making it |
| 101 |
particularly attractive for low-memory embedded applications. |
| 102 |
|
| 103 |
The libraries are not intended for 8-bit or 16-bit machine |
| 104 |
architectures (e.g., old MS-DOS C compilers). For maximum performance, |
| 105 |
a 32-bit processor is required (64-bit systems work too, of course). |
| 106 |
On architectures with 16-bit pointer arithmetic, the full-featured |
| 107 |
jbig.c library can process only very small images. |
| 108 |
|
| 109 |
Special features of the full-featured jbig.c variant: |
| 110 |
|
| 111 |
- Fully reentrant multithread-capable design (no global or static |
| 112 |
variables, isolated malloc()/free() calls, etc.) |
| 113 |
|
| 114 |
- Capable of handling incomplete and growing JBIG data streams in |
| 115 |
order to allow earliest display of low resolution versions |
| 116 |
|
| 117 |
- Capable of handling several incoming data streams simultaneously |
| 118 |
in one single process and thread |
| 119 |
|
| 120 |
- Especially designed with applications in mind that want to display |
| 121 |
incoming data as early as possible (e.g., similar to the way in |
| 122 |
which Netscape Navigator handles incoming GIF images) |
| 123 |
|
| 124 |
- Implements all JBIG features and options including progressive and |
| 125 |
sequential encoding, multiple bit planes, user specified |
| 126 |
resolution reduction and deterministic prediction tables, adaptive |
| 127 |
template changes for optimal performance on half-tone images, |
| 128 |
deterministic prediction, typical prediction in lowest and |
| 129 |
differential layers, various stripe orderings, etc; only the SEQ |
| 130 |
and HITOLO options are currently not supported by the decoder |
| 131 |
(they are normally never required, but could be added later in |
| 132 |
case of user requirements) |
| 133 |
|
| 134 |
- Suitable for fax applications, satisfies ITU-T T.85 profile |
| 135 |
|
| 136 |
- Efficient code, optimized utilization of 32-bit processor |
| 137 |
registers |
| 138 |
|
| 139 |
- Very easy to use documented C library interface |
| 140 |
|
| 141 |
- Included Gray code conversion routines for efficient encoding |
| 142 |
of grayscale images |
| 143 |
|
| 144 |
- Ready-to-use pbmtojbg and jbgtopbm converters. |
| 145 |
|
| 146 |
Special features of the light-weight jbig85.c variant: |
| 147 |
|
| 148 |
- Suitable for low-memory embedded applications |
| 149 |
|
| 150 |
- Implements only the JBIG1 subset defined in the ITU-T T.85 |
| 151 |
profile (single bit plane, no differential layers) |
| 152 |
|
| 153 |
- Requires only three pixel rows of the uncompressed image to be |
| 154 |
kept in memory |
| 155 |
|
| 156 |
- Handles all NEWLEN modes of operation required by ITU-T T.85 with |
| 157 |
just a single pass over the data, automatically performing the |
| 158 |
necessary lookahead after the last stripe |
| 159 |
|
| 160 |
- Codec buffers only a few bytes of arithmetic-codec data and outputs |
| 161 |
resulting bytes or lines as soon as they are available. |
| 162 |
|
| 163 |
I will try to provide free support and maintenance for this software |
| 164 |
for the foreseeable future, depending on my available time. |
| 165 |
|
| 166 |
Happy compressing ... |
| 167 |
|
| 168 |
Markus Kuhn |
| 169 |
|
| 170 |
-- |
| 171 |
Markus Kuhn, Computer Laboratory, University of Cambridge |
| 172 |
http://www.cl.cam.ac.uk/~mgk25/ || CB3 0FD, Great Britain |