SaveImage
Top  Previous  Next

Description

Saves the current frame buffer in the specified image file. The method supports RAW, BMP, TIFF and JPEG formats with a selectable compression.


Syntax


[VB]
objActiveDcam.SaveImage File [, Compression]


[C/C++]
HRESULT SaveImage( bstr File, long Compression );


Data Types
[VB]

File: String
Compression: Integer (optional)


Parameters
[C/C++]

File [in]  
The string containing the file name and path  
Compression [in]  
The file compression ratio  


Return Values


S_OK  
Success  
E_FAIL  
Failure.  
E_INVALIDARG  
Invalid file name.  


Example


This VB example saves the current frame in a JPEG file with the specified compression quality.


ActiveDcam1.SaveImage "C:\\myframe.jpg", 75
 

Remarks


The image file format in which the frame will be saved is defined by the file extension indicated in the File argument. Use "raw" for a RAW file, "bmp" for a BMP file, "tif" for TIFF, and "jpg" for JPEG. If none of these extensions are found in the File string, an error will occur.

When the image saving is complete, the FrameRecorded event is fired.

The way the Compression argument is treated depends on the file format.

BMP files:  
Compression = 0 - no compression  
Compression = 1 - RLE compression (not implemented in this version)  
 
TIFF files:  
Compression = 0 - no compression  
Compression = 1 - LZW compression  
Compression = 2 - PackBits compression  

JPEG files:  
Compression is an integer value in the range 0-100 specifying the quality of the image. Lower values correspond to a lower quality with a higher compression, while higher values correspond to a higher quality with a lower compression.  
 
RAW files:  
Compression has no effect.  
 
If Compression parameter is omitted, BMP and TIFF files will be recorded with no compression, while JPEG files will be recorded with quality of 75.

When the RAW format is selected, the resulting file will contain undecoded frame data as they arrived from the camera. See GetRawData for more details.