Working with the LEADMrc Control

LEADTOOLS offers the LEADMrc Control to handle mixed raster content files. This control enhances LEADTOOLS input/output functionality by adding support for color documents containing mixed image and text components. The Mixed Raster Content (MRC) format was developed by the International Telecommunications Union as part of ITU-T Recommendation T.44, and is defined in the proposed standard, RFC-2301, File Format for Internet Fax. The MRC model divides a page into strips and up to 3 layers: consisting of Mask, Foreground and Background layers. Each layer can be coded and compressed independently. Subsequently, these layers can be uncompressed and combined to restore the original image.

The LEADTOOLS implementation of the MRC model involves dividing an object into segments. A segment is a rectangular area on the bitmap that can be classified as text, grayscale, or picture, depending on the number of colors used in its area.

LEADTOOLS offers two methods for saving files: the Save method and the SaveT44 method. With these methods it is possible to save an MRC bitmap in any of the following modes:

image\sqrblit.gif MRC: This mode uses the Standard T44 file format. The default extension is *.MRC. Please note that multipage files using this format can be loaded, but only one page can be saved. Use the SaveT44 method to save a file in this format.

image\sqrblit.gif LEAD MRC: This mode uses the LEAD proprietary T44 file format. The default extension is *.MRC. Please note that this is a single page file format. Use the Save method to save a file in this format.

image\sqrblit.gif TIF-MRC: This mode uses the Tagged Image Format and the Standard T44 format as a subtype. The default extension is *.TIF. Multipage files using this format can be loaded and can also be saved. Use the SaveT44 method to save a file in this format.

image\sqrblit.gif TIF-LEAD-MRC: This mode uses the Tagged Image Format and the LEAD proprietary T44 format as a subtype. The default extension is *.TIF. Multipage files using this format can be loaded and can also be saved. Use the Save method to save a file in this format.

The Standard T44 format file uses two different segment types: 1-bit Text and picture. The 1-bit text segments can be compressed using Fax G3 1D, Fax G3 2D, Fax G4 or JBIG compression and picture segments can be compressed using JPEG compression. Some of these compression schemes use a quality factor that allows the amount of compression to be controlled.

The LEAD proprietary MRC format uses the following segment types: 1-bit text, 2-bit text, 2-bit picture grayscale, 8-bit grayscale, and picture. The 1-bit text segments can be compressed using Fax G3 1D, Fax G3 2D, Fax G4 or JBIG compression. The 2 bit grayscale segments can be compressed using JBIG compression. The 8-bit grayscale segments can be compressed using JPEG, LEAD CMP or LEAD CMW compression, and pictures can be compressed using JPEG, LEAD CMP or LEAD CMW compression. Some of these compression schemes use a quality factor that allows the amount of compression to be controlled.

The following properties can be used to set the default colors for a file:

BaseForeColor property

BaseBackColor property

Loading Capabilities

To load a Mixed Raster Content (MRC) bitmap call the Load method. This method loads a single page from a MRC file. When loading from a multi-page document, specify the page number as one of the input parameters. To get the total pages in the MRC file call the GetPagesCount method, which fills the MRCPagesCount property with the number of pages in the file.

Saving Capabilities

The LEAD proprietary T44 format used by the Save method differs from the Standard T44 format used by the SaveT44 method in the following ways:

image\sqrblit.gif when using the LEAD Proprietary T44 format, segments can be 1-bit black and white, 1-bit color, 2-bit color, 2-bit grayscale, 8-bit grayscale, or picture. When using the standard T44 format, segments can be 1-bit black and white, 1-bit color, or picture.

image\sqrblit.gif while any application that supports the T44 standard can open a file saved in those formats, only an application with LEADMrc support can open a file saved in the LEAD proprietary T44 format.

image\sqrblit.gif saving a given bitmap in the LEAD proprietary T44 format creates a smaller file than saving the same bitmap in the Standard T44 format.

image\sqrblit.gif saving a given bitmap in the LEAD proprietary T44 format creates a higher quality file than saving the same bitmap in the Standard T44 format.

image\sqrblit.gif when saving a multipaged file as a Standard T44 format (MRC), only one page can be saved. The LEAD Proprietary T44 format (LEAD-MRC) is a single page file format.

Note:

The characteristics of individual images differ greatly and not every image compresses well as mixed raster content.

The LEADTOOLS implementation of the MRC model involves dividing an object into segments. A segment is a rectangular area on the bitmap that can be classified as text, grayscale, or picture, depending on the number of colors used in its area. Segmentation can be performed automatically, manually, or internally. Different types of compression are available, depending upon which save method is being used as well as which segment type is being compressed.

The following properties may be used to specify compression and quality characteristics used when saving an MRC file:

MaskCoder property

PictureCoder property

PictureQFactor property

In addition, when saving a bitmap in one of the LEAD Proprietary T44 formats, the following properties can be used to specify compression and quality for the additional segment types available to that format:

Grayscale2BitCoder property

Grayscale8BitCoder property

Grayscale8BitQFactor property

Text2BitCoder property

With LEADTOOLS it is easy to handle the segmentation process, whether performing segmentation automatically or manually.

General Segmentation

A segment is a rectangular area on the bitmap. The segmentation process classifies the segments of a bitmap as text, grayscale or picture. Call the StartSegmentation method to initialize the segmentation process, before calling any of the segmentation methods. To end the segmentation process call the StopSegmentation method, which frees any memory associated with the segmentation process. Each call to the StartSegmentation method requires a corresponding call to the StopSegmentation method.

Auto-Segmentation

Calling the AutoSegment method will perform automatic segmentation using the LEADTOOLS MRC engine. LEADTOOLS segments the bitmap, classifying the segments as text, grayscale or picture. An OnEnumSegments event is fired for each segment generated. Set the following properties to control the segmentation process:

CombineFactor property

CombineFlags property

ImageType property

Sensitivity property

To enumerate the segments, call the EnumSegments method. This method provides the segment coordinates and their IDs. To modify a segment type or its coordinates, use the SetSegmentData method. This method updates only one segment’s data each time it is called. To delete a segment, call the DeleteSegment method. To combine two segments, call the CombineSegments method. To copy the segmentation data, call the CopySegmentationData method.

Save the segmentation data to a file by calling the SaveSegmentation method. To load the saved segmentation data from a file, call the LoadSegmentation method.

Manual Segmentation

To use manual segmentation, call the CreateNewSegment method to add a new segment and customize the segment coordinates and type. An OnEnumSegments event is fired for each segment generated. Set the following properties to control the segmentation process:

CombineFactor property

CombineFlags property

To modify a segment type or its coordinates, use the SetSegmentData method. The SetSegmentData method updates only one segment’s data each time it is called. To delete a segment, call the DeleteSegment method. To combine two segments, call the CombineSegments method. To copy the segmentation data, call the CopySegmentationData method.

Save the segmentation data to a file by calling the SaveSegmentation method. To load the saved segmentation data from a file, call the LoadSegmentation method.

Auxiliary Elements

To control generating run-time exceptions with method error conditions, use:

EnableMethodErrors property

Error Property

ErrorMsg Property