virtual L_INT LFile::Save(nFormat, nBitsPerPixel, nQFactor, nPageNumber, uFlags)
virtual L_INT LFile::Save(nFormat, nBitsPerPixel=0, nQFactor=2, uFlags=MULTIPAGE_OPERATION_OVERWRITE, pSaveFileOption=NULL)
Saves an image contained in the class object's associated bitmap to a file, in any of the supported compressed or uncompressed formats.
Output file format. For valid values, refer to Files To Be Included With Your Application.
Resulting file's pixel depth. Note that not all bits per pixel are available to all file formats. For valid values, refer to Files To Be Included With Your Application. 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.
This parameter is used when saving an image to file format that supports quality factor (QFactor). QFactor is a number that determines the degree of loss in the compression process.
For possible values, refer to Compression Quality Factors.
The number of the page on which to save the bitmap.
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. |
Pointer to optional extended save options. Pass NULL to use the default save options.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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.
NOTE: 4:1:1 and 4:2:2 formats use subsampling for the color components. In the case of 4:1:1, the color components for 4 pixels are averaged during compression. This will cause a color shift, but the shift is tolerable for low compression ratios. If you have high compression and repeated savings, then the color shift will increase. Due to this characteristic of the JPEG algorithm, the only ways to avoid this are to: (a) use 4:4:4 (which has no subsampling), or (b) avoid repeated load and resave.
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.
Win32, x64.
For an example, refer to LFile::Load.
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document