#include "ltsgm.h"
L_LTSGM_API L_INT L_MrcSaveBitmapList(hSegment, uhSegmentCount, hList, pCmpOption, pszFileName, nFormat)
Saves MRC images contained in a bitmap list to a file using the MRC LEAD, standard Proprietary T44 or PDF format.
An array of segmentation handles. This handle is obtained by calling the L_MrcStartBitmapSegmentation function.
Number of segmentation handles.
Handle to the list of bitmaps 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.
Output file format. Possible values are:
Value | Meaning |
---|---|
FILE_TIF_MRC | [177] Tagged Image File with standard MRC Compression (Standard T44). (Supports multi-page). |
FILE_PDF_LEAD_MRC | [338] PDF compression using MRC segmentation technique. |
FILE_TIF_LEAD_MRC | [315] Tagged Image File with LEAD proprietary MRC. (Supports multi-page). The default file extension is *.TIF. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
<= 0 | An error occurred. Refer to Return Codes. |
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 L_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:
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.
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 L_MrcSaveBitmapT44, or L_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 L_MrcSaveBitmapList 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_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 hSegmentation array is NULL, or has any NULL element, then the function will automatically segment the bitmaps in hList by calling L_MrcSegmentBitmap. 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 (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
L_INT MrcSaveBitmapListExample(HSEGMENTATION* hSegmentation,
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 = L_MrcSaveBitmapList(hSegmentation, uhSegments, hList, &CmpOption, pszFileName, FILE_TIF_LEAD_MRC);
if (nRet != SUCCESS)
return nRet;
return SUCCESS;
}