Implementing JBIG Features

JBIG defines a method for lossless compression encoding of a bi-level image (two color image). This method can also be used for coding grayscale and color images. LEADTOOLS now completely supports all three types of images, giving you the ability to make full use of this powerful compression.

LEADTOOLS also supports the Progressive capability of JBIG, allowing you to store and send multiple representations of images at different resolutions without any extra storage overhead. You can use the L_ReadLoadResolutions function to examine which sizes are available in a file. You can then use the L_SetLoadResolution function to specify which size to load. (The L_GetLoadResolution function only gets the last width and height values that were set with the L_SetLoadResolution function.). When saving a file, you can use L_SetSaveResolution to set resolutions for the next save operation . If you want to get the information saved by the last call to L_SetSaveResolution, you can use L_GetSaveResolution.

To achieve the highest compression ratios available in the JBIG format, LEAD now takes full advantage of all the functional blocks of this robust standard:

image\sqrblit.gif The Adaptive Arithmetic Encoder , which presents the heart of this format, has the ability to predict and hence encode future data symbols based on the data which is being currently encoded.

image\sqrblit.gif The Adaptive Template Block provides real coding gain for images rendered by grayscale with halftoning. This gain ratio approaches 80% in some situations.

This feature is useful for dealing with grayscale image data.

image\sqrblit.gif The Typical Prediction Block speeds implementations and provides some coding gain.

image\sqrblit.gif The Resolution Reduction Block is used to get a lower resolution version of an image so that no loss of data is encountered. This is mainly important for bi-level images, to avoid any deletion of thin lines.

image\sqrblit.gif The Deterministic Prediction Block provides good coding gain when saving more than one resolution layer in the same file.

All the free parameters specified by the JBIG standard are applied in LEAD to achieve maximal compression and the highest speed for any saving or loading operation.

LEADTOOLS currently supports more than 1 bit plane and more than 1 resolution layer in JBIG files. However, we do not support saving different ordering of strips inside the JBIG file. The JBIG filter is built now such that it supports the optimum ordering of strips inside the JBIG file such that as soon as you open the file you find the lowest resolution layer.

JBIG supports progressive loading of an image. This is done by loading the lowest resolution available in a file and then loading the next resolution, and so on, up to the last available resolution. To implement progressive loading of a JBIG image, use LOADFILEOPTION to set the number of passes/resolutions to load. Progressive loading will be implemented as follows:

1.

If only one resolution exists in the JBIG File, then the FILEREADCALLBACK function will be called with the image data for that resolution as it is decompressed.

2.

If the image contains more than one resolution and (Passes >= nResolutions, where nResolutions represents the number of resolutions present in the file,) then the FILEREADCALLBACK function will be called with the image data from the lowest resolution available in the file. The data that gets passed to the callback and/or inserted into the bitmap handle will be padded to the remaining width (that is, the size of the last resolution available in the file) with 0s. This will be repeated nResolution times, until the entire image (that is, the last resolution available) is loaded. Setting nPasses to CALLBACK_WHEN_MEANINGFUL or CALLBACK_ALWAYS has the same effect.

3.

If the image contains more than one resolution and (Passes is < nResolutions) then the process is the same as in case 2, except loading starts with the first resolution available, continues with the 2nd resolution, and so on, up to resolution Passes-1, and then loading is completed with the decompression of the last resolution available in the file.

 

For more information, refer to:

Files To Be Included With Your Application

JBIG Format (JBG)

JBIG2 Format (JB2)