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 ReadLoadResolutions method to examine which sizes are available in a file. You can then use the SetLoadResolution method to specify which size to load. (The GetLoadResolution method only gets the last width and height values that were set with the SetLoadResolution method.). When saving a file, you can use the SaveResolutionHeight and SaveResolutionWidth properties to set resolutions for the next save operation . To set the number of resolutions to save, set the SaveResolutionCount property.

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 the ProgressivePasses property. Progressive loading will be implemented as follows:

1)

If only one resolution exists in the JBIG File, then the OnStatus event will be called for that resolution as it is decompressed. The percentages sent to the OnStatus event will be 0 to 100.

2)

If the image contains more than one resolution and (ProgressivePasses >= nResolutions, where nResolutions represents the number of resolutions present in the file) then the OnStatus event will be generated for each resolution layer that is loaded. The image data 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 ProgressivePasses to PROGRESSIVEPASSES_WHEN_MEANINGFUL or PROGRESSIVEPASSES_ALWAYS has the same effect.

 

The percentages passed to the OnStatus event represent what percentage that resolution is of the whole. For example, if there are three resolutions present in the file (nResolutions = 3), the dimensions of the first resolution layer are one-fourth the dimensions of the top resolution layer. The dimensions of the second resolution layer are one-half the dimensions of the top resolution layer. Consequently, when the first resolution layer is loaded, the percentages sent to the OnStatus event are from 0 to 25. When the second resolution layer is loaded, the percentages sent to the OnStatus event are from 0 to 50. When the top resolution layer is loaded, the percentages sent to the OnStatus event are 0 to 100.

3)

If the image contains more than one resolution and (ProgressivePasses 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. Again, the percentages sent to the OnStatus event represent what percentage that resolution is of the whole. For example, if there are three resolutions present in the file, (nResolutions = 3), and the ProgressivePasses property is 2, the smallest resolution will be loaded first. The percentages sent to the OnStatus event will be 0 to 25. The second resolution level will be skipped and the top resolution level loaded. The percentages sent to the OnStatus event for the top resolution level will be 0 to 100.

JBIG support is available only with the JBIG Module. To unlock JBIG support, UnlockSupport must be called with the key found on the JBIG Module Certificate, which will be e-mailed to you. UnlockSupport(L_SUPPORT_JBIG, "JBIG Certificate key") tells the package to unlock JBIG support and passes the key for verification. For more information about required files, refer to Files To Be Included With Your Application.