SaveBuffer method (Main Control)

C++ Builder example

Delphi example

 

Builder Syntax

int SaveBuffer (void *pBuffer, unsigned iBufferSize, int iFormat, int iBitsPerPixel, int iQuality, LEADTyp::pCardinal piSize);

Delphi Syntax

SaveBuffer (pBuffer: Pointer; iBufferSize: Cardinal; iFormat, iBitsPerPixel, iQuality: Integer; piSize: pCardinal): Integer;

Overview

Refer to Using Memory-Resident Image Files.

Remarks

Saves a bitmap to a file in a memory buffer that the user must allocate. The buffer can be output in any of the supported compressed or uncompressed file formats.

This method is similar to the SaveMemory method, except that the user is responsible for allocating/reallocating the buffers. If the user wants to allocate a buffer that is large enough to hold the file in memory, an upper bound on the file size can be estimated by the following formula:

RequiredBytes = (Image Width) * (Image Height) * (BitsPerPixel) / 8

Note that this is an estimate. This does not include the size of the file header, and it does not take into account any compression.

This method supports signed data images, but only DICOM and TIFF formats support signed data. This method 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.

See Also

Elements:

Save method, SaveWithStamp method, SaveMemory method

Topics:

Raster Images: Saving Files