WriteImage Method
Syntax
CWIMAQVision.WriteImage SourceImage, Path, Format [, ColorPalette]
Return Type
On success, this method returns 0. On failure, this method returns a negative number.
Purpose
Writes an image to a file.
Remarks
Use this method with all image types. The following table indicates the image types that each image file format supports.
File Types | Image Types |
---|---|
AIPD | all image types |
BMP, JPEG | 8-bit, RGB32 |
TIFF | 8-bit, 16-bit, RGB32, RGBU64 |
PNG | 8-bit, 16-bit, RGB32, RGBU64 |
JPEG2000 | 8-bit, 16-bit, RGB32, RGBU64 |
This method does not write overlay information, calibration information, pattern matching template information, or custom data to the file. To write this data, use CWIMAQVision.WriteImageAndVisionInfo.
Parameters
SourceImage As CWIMAQImage
The image to write to a file.
Path As String
The name of the file.
Format As CWIMAQFileFormats
The standard file format to create. If this value is cwimaqFileUnknown, the method creates a file with the BMP file format.
ColorPalette As Variant
[Optional] A CWIMAQPalette object that defines a color table to associate with 8-bit images. Do not provide this input to write a grayscale palette to the file.
Example
Private Sub Run_Click() Dim Filename As String 'Write an image in Viewer1 to a JPEG file. 'The name of the file is in Filename. CWIMAQVision1.WriteImage CWIMAQViewer1.Image, Filename, _ cwimaqFileJPEG, CWIMAQViewer1.Palette End Sub