L_LTSGM_API L_INT L_MrcSaveBitmap(hSegment, pBitmap, pCmpOption, pszFileName, pfnCallback, pUserData, nFormat, pSaveOptions)
Saves an MRC image contained in a bitmap to a file using the LEAD Proprietary T44 format.
An existing segmentation handle. This handle is obtained by calling the L_MrcStartBitmapSegmentation function.
Pointer to the bitmap handle referencing the bitmap that holds the image data.
Pointer to the COMPRESSIONOPTIONS structure that contains the compression information to use when saving the file.
Character string that contains the output file name.
Reserved for future use. Pass NULL.
Reserved for future use. Pass NULL.
Output file format. Possible values are:
|FILE_LEAD_MRC|| LEAD Proprietary MRC. The default file extension is *.MRC.|
|FILE_TIF_LEAD_MRC|| Tagged Image File with LEAD proprietary MRC. (Supports multi-page). The default file extension is *.TIF.|
|FILE_PDF_LEAD_MRC|| PDF compression using MRC segmentation.|
Pointer to optional extended save options. Pass NULL to use the default save options.
|SUCCESS||The function was successful.|
|<= 0||An error occurred. Refer to Return Codes.|
Use this function to save the bitmap in one of the LEAD Proprietary MRC formats: either as a LEAD proprietary MRC format file (if the nFormat value is FILE_LEAD_MRC), or as a TIF file with a LEAD MRC subtype format (if the nFormat value is FILE_TIF_LEAD_MRC or as multiple document PDF using segmentation capabilities (if the nFormat value is FILE_PDF_LEAD_MRC). When an nFormat value of FILE_LEAD_MRC is used, *.MRC is the default file extension. When an nFormat value of FILE_TIF_LEAD_MRC is used, *.TIF is the default file extension.
Use the L_MrcSaveBitmap function to save a file in one of the LEAD proprietary MRC formats if you want to:
Take advantage of the greater number of different segment types available when using the proprietary format.
Create smaller files than would be possible by saving them to the Standard T44 format.
Create higher quality files than would be possible by saving them to the Standard T44 format.
Please note that the LEAD proprietary MRC and PDF format files are single-page file formats, while the TIF file with a LEAD MRC subtype formats are multi-paged file formats.
Use the L_MrcSaveBitmapT44 function to save a file if it is necessary that the file be readable by any application that supports the T44 standard.
It is best to perform segmentation before calling the L_MrcSaveBitmap function. Segmentation can be performed automatically by calling the L_MrcSegmentBitmap function, or performed manually by calling the L_MrcCreateNewSegment function. Call the L_MrcStartBitmapSegmentation function before calling any of the segmentation methods. When the handle to the segmentation is no longer needed, free it by calling the L_MrcStopBitmapSegmentation function. For more information on segmentation, refer to General Segmentation, Auto-Segmentation, and Manual Segmentation.
When using the L_MrcSaveBitmap function, segments can be any of the following types:
If the hSegmentation parameter is NULL, then the function will automatically segment the bitmap by calling L_MrcSegmentBitmap and then save the image file. The L_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, 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, the nGrayscale8BitQFactor, and the nText2BitCoder members of the COMPRESSIONOPTIONS structure are used with the FILE_TIF_LEAD_MRC and FILE_PDF_LEAD_MRC formats only.
Control page replacement/insertion operations using some of the member values available in the SAVEFILEOPTION structure.
*NLS (N-Layer stripe) means that each stripe may contain one or more mask layers, foreground layers, and background layers.
Required DLLs and Libraries
L_INT MrcSaveBitmapExample(HSEGMENTATION hSegmentation,
/* 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 using the LEAD Proprietary T44 Format */
nRet = L_MrcSaveBitmap (hSegmentation, pBitmap, &CmpOption, pszFileName, NULL, NULL, FILE_LEAD_MRC, NULL);
if (nRet != SUCCESS)