SaveImageToDisk Method

NI Vision for Visual Basic

SaveImageToDisk Method

Syntax

CWIMAQ.SaveImageToDisk Filename, SourceImage

Return Type

Long

This method returns 0 on success, a negative number on an error, and a positive number on a warning.

Purpose

Saves an image to disk. This method saves border and padding information with the image data. To write an image to file without the border and padding information use the WriteImage method.

Remarks

Call this method to save an image to disk in a native operating system-specific format, such as bitmap (BMP) or tagged image file format (TIFF). The image must be the same size and have the same bits per pixel as images in the image collection of the CWIMAQ control. Save 10-bit, 12-bit, 14-bit, or 16-bit monochrome images as portable network graphics (PNG) files.

Parameters

Filename As String

The filename of the image to save to disk.

SourceImage As CWIMAQImage

The image to save to disk.

Example

Private Sub Run_Click()
    CWIMAQ1.AcquisitionType = cwimaqAcquisitionOneShot
    CWIMAQ1.AcquireImage
    CWIMAQ1.SaveImageToDisk "c:\images\image1.bmp", CWIMAQ1.Images(1)
End Sub