LFile::SaveBitmap

#include "ltwrappr.h"

virtual L_INT LFile::SaveBitmap(nFormat, nBitsPerPixel, nQFactor, nPageNumber, uFlags)

virtual L_INT LFile::SaveBitmap(nFormat, nBitsPerPixel=0, nQFactor=2, uFlags=MULTIPAGE_OPERATION_OVERWRITE, pSaveFileOption=NULL)

L_INT nFormat;

/* output file format */

L_INT nBitsPerPixel;

/* resulting file's pixel depth */

L_INT nQFactor;

/* quality factor */

L_INT nPageNumber;

/* number of the page on which to save the bitmap */

L_UINT uFlags;

/* flag that indicates how to save the page */

SAVEFILEOPTION pSaveFileOption;

/* pointer to optional extended save options */

Saves an image contained in the class object's associated bitmap to a file, in any of the supported compressed or uncompressed formats.

Parameter

Description

nFormat

Output file format. For valid values, refer to Formats of Output Files.

nBitsPerPixel

Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Formats of Output Files. If nBitsPerPixel is 0, the file will be stored using the closest BitsPerPixel value supported by that format. For example, if a file format supports 1, 4, and 24 BitsPerPixel, and LBitmapBase::GetBitsPerPixel returns 5, the file will be stored as 24 bit. Likewise, if LBitmapBase::GetBitsPerPixel returns 2, the file will be stored as 4 bit.

nQFactor

This parameter is used when saving an image file to FILE_CMP, FILE_JPEG, FILE_JPEG_411, FILE_JPEG_422, FILE_TIF_JPEG, FILE_LEAD1JTIF, FILE_LEAD2JTIF, FILE_FPX_JPEG_QFACTOR, FILE_EXIF_JPEG, and FILE_PNG. Qfactor is a number that determines the degree of loss in the compression process.

 

For possible values, refer to Compression Quality Factors.

nPageNumber

The number of the page on which to save the bitmap.

uFlags

Flag that indicates how to save the bitmap. Possible values are:

 

Value

Meaning

 

MULTIPAGE_OPERATION_OVERWRITE

[1] No insert/replace/append is performed. An existing file is overwritten.

 

MULTIPAGE_OPERATION_APPEND

[2] or [-1] The page is appended if the file exists.

 

MULTIPAGE_OPERATION_REPLACE

[3] Replace the page specified in the nPageNumber variable.

 

MULTIPAGE_OPERATION_INSERT

[4] Insert the bitmap at the specified page number.

pSaveFileOption

Pointer to optional extended save options. Pass NULL to use the default save options.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

If the bitmap is 8 bits per pixel or greater, use the LEAD CMP format or one of the JPEG (JTIF or JFIF) formats to save disk space.

If the bitmap is 1-bit per pixel, use the LEAD 1-bit format or a CCITT Group 3 or 4 format to save disk space.

For CCITT Group 3 and 4 formats, the first RGBQUAD structure in the bitmap handle's hPalette field determines the white component of the image. If the rgbRed field is 0, then all 0 bits in the image are assumed to be black. Otherwise, all zero (0) bits in the image are assumed white.

Support for 12 and 16-bit grayscale images is only available in the Document/Medical toolkits.

For information on saving annotations as a tag in a TIFF file, refer to LAnnContainer::SaveTag.

Note: More options are available in the SAVEFILEOPTION structure.

This function supports signed data images, but only DICOM and TIFF formats support signed data. This function will return an error code if you attempt to save a signed image to a format other than DICOM or TIFF.

If the bitmap has a region, the region stored in the bitmap will be saved, if the image is saved as one of the TIFF file formats.

For information on saving bitmaps that have been window leveled, refer to Saving Window-Leveled Bitmaps.

Required DLLs and Libraries

LTFIL
File format DLLs

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LAnnContainer::SaveTag, Class Members

Topics:

Raster Image Functions: Saving Files

 

Raster Image Functions: Maintaining File Comments and Tags

 

Raster Image Functions: Low-Level Compression Functions

 

Raster Image Functions: Loading and Saving Stamp Images

 

Raster Image Functions: Redirecting Input and Output

 

Raster Image Functions: Input and Output

 

Loading and Saving Images

 

Saving a Region

Example

For an example, refer to LFile::LoadBitmap.