LSegment::MrcSaveBitmapList

Summary

Saves MRC images contained in a bitmap list to a file using the MRC LEAD, standard Proprietary T44 or PDF format.

Syntax

#include "ltwrappr.h"
#include "ltsgm.h"

L_INT LSegment::MrcSaveBitmapList( hSegmentList, uhSegmentCount, hList, pCmpOption, pszFileName, nFormat)

Parameters

HSEGMENTATION * hSegmentList

An array of segmentation handles. This handle is obtained by calling the LSegment::MrcStartBitmapSegmentation function.

L_UINT uhSegmentCount

Number of segmentations.

HBITMAPLIST hList

Handle to the list of bitmaps that holds the image data.

pCOMPRESSIONOPTIONS pCmpOption

Pointer to the COMPRESSIONOPTIONS structure that contains the compression information to use when saving the file.

L_TCHAR * pszFileName

Character string that contains the output file name.

L_INT nFormat

Output file format. Possible values are:

Value Meaning
FILE_TIF_MRC [177] Tagged Image File with standard MRC Compression (Standard T44). (Supports multipage).
FILE_PDF_LEAD_MRC [338] PDF compression using MRC segmentation technique.
FILE_TIF_LEAD_MRC [315] Tagged Image File with LEAD proprietary MRC. (Supports multipage). The default file extension is *.TIF.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Comments

Use this function to save a list of bitmaps as a TIF file using the Standard T44 format (if the nFormat value is FILE_TIF_MRC), as a TIF file with a LEAD MRC subtype format (if the nFormat value is FILE_TIF_LEAD_MRC), or as a multipage PDF using segmentation capabilities (if the nFormat value is FILE_PDF_LEAD_MRC). If nFormat is FILE_TIF_MRC or FILE_TIF_LEAD_MRC, *.TIF is the default file extension. If nFormat is FILE_PDF_LEAD_MRC, *.PDF is the default file extension.

Use the LSegment::MrcSaveBitmapList function to save a list of bitmaps as a TIF file with a Standard T44 subtype format, LEAD MRC subtype format, or PDF file, based on the LEAD segmentation technique, if you want to:

All formats supported by this function generate multipage files (TIF, or PDF). The number of pages in the file is either uhSegmentCount or the number of images in hList, whichever is smaller.

Use the LSegment::MrcSaveBitmapT44, or LSegment::MrcSaveBitmap functions to save a single image or to append, inset overwrite to already existing TIF file.

It is best to perform segmentation for all images in the list before calling the LSegment::MrcSaveBitmapList function. Segmentation can be performed automatically by calling the LSegment::MrcSegmentBitmap function, or performed manually by calling the LSegment::MrcCreateNewSegment function.

Call the LSegment::MrcStartBitmapSegmentation function before calling any of the segmentation methods. When the LSegment class object is no longer needed, free it by calling the LSegment::MrcStopBitmapSegmentation function. For more information on segmentation, refer to General Segmentation, Auto-Segmentation, and Manual Segmentation.

When using the LSegment::MrcSaveBitmapList function, segments can be any of the following types:

SEGTYPE_BACKGROUND

SEGTYPE_ONECOLOR

SEGTYPE_TEXT_1BIT_BW

SEGTYPE_TEXT_1BIT_COLOR

SEGTYPE_TEXT_2BITBW

SEGTYPE_TEXT_2BIT_COLOR

SEGTYPE_GRAYSCALE_2BIT

SEGTYPE_GRAYSCALE_8BIT

SEGTYPE_PICTURE

If the bitmap hasnt been segmented, or has any NULL element, then the function will automatically segment the bitmaps in hList by calling LSegment::MrcSegmentBitmap. The LSegment::MrcSegmentBitmap function maps the text, grayscale and picture segments into layers (mask, background and foreground layers) as defined in the NLS* model of the T.44 standard. 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. The Mixed Raster Content (MRC) format was developed by the International Telecommunications Union as part of ITU-T Recommendation T.44. For more information on Mixed Raster Content (MRC) formats, refer to General Information.

If the pCmpOption parameter is NULL, then the function will use Fax G4 compression for the mask layer (1-bit), JPEG compression for the 24 bit image segments and 2 for the quality factor, JPEG compression for the 8 bit grayscale segments and 2 for the quality factor, and JBIG compression for the 2 bit text and 2 bit grayscale segments. For more information, refer to COMPRESSIONOPTIONS. Note that the nGrayscale2BitCoder, the nGrayscale8BitCoder, and the nGrayscale8BitQFactor members of the COMPRESSIONOPTIONS structure are used only with the FILE_TIF_LEAD_MRC formats. The nText2BitCoder member of the COMPRESSIONOPTIONS structure is used with the FILE_TIF_LEAD_MRC and FILE_PDF_LEAD_MRC formats only.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT LSegment__MrcSaveBitmapListExample(LSegment& LeadSegment, L_UINT uhSegments, HBITMAPLIST hList, L_TCHAR* pszFileName) 
{ 
   L_INT                nRet;  
   COMPRESSIONOPTIONS   CmpOption;  
 
   /* Initialize the compression structure */ 
   CmpOption.uStructSize = sizeof(COMPRESSIONOPTIONS);  
   CmpOption.nMaskCoder = MRC_MASK_COMPRESSION_FAX_G3_1D;  
   CmpOption.nPictureCoder = MRC_PICTURE_COMPRESSION_JPEG;  
   CmpOption.nPictureQFactor = 10;  
   CmpOption.nGrayscale8BitCoder = MRC_GRAYSCALE_COMPRESSION_GRAYSCALE_CMW_8BIT;  
   CmpOption.nGrayscale8BitFactor = 2;  
   CmpOption.nGrayscale2BitCoder = MRC_GRAYSCALE_COMPRESSION_JBIG_2BIT;  
   CmpOption.nText2BitCoder = MRC_TEXT_COMPRESSION_JBIG_2BIT;  
 
   /* Save the MRC bitmap list using the LEAD Proprietary T44 Format */ 
   nRet = LeadSegment.MrcSaveBitmapList(NULL, uhSegments, hList, &CmpOption, pszFileName, FILE_TIF_LEAD_MRC);  
 
   return nRet;  
} 
Help Version 22.0.2022.12.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS MRC C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.