WriteImageAndVisionInfo Method

NI Vision for Visual Basic

WriteImageAndVisionInfo Method

Syntax

CWIMAQVision.WriteImageAndVisionInfo SourceImage, Path [, ColorPalette]

Return Type

Long

On success, this method returns 0. On failure, this method returns a negative number.

Purpose

Writes an image, along with extra vision information associated with the image, to a PNG file. This extra vision information includes overlay, pattern matching template, and calibration information, and custom data.

Remarks

Use this method with U8, U16, I16, RGB32, RGBU64, and HSL32 images.

Parameters

SourceImage As CWIMAQImage

The image to write to a file.

Path As String

The name of the file.

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
    
    'Overlay a line on the image in Viewer1
    CWIMAQViewer1.Image.Overlays(1).DrawLine CWIMAQVision1.MakeLine(10, 10, 100, 100), _
                                             vbRed
    'Write the image in Viewer1, the associated vision information and the palette
    'to a file. The name of the file is in Filename.
    CWIMAQVision1.WriteImageAndVisionInfo CWIMAQViewer1.Image, Filename, _
                                          CWIMAQViewer1.Palette
End Sub

See Also

ReadImage

WriteImage

WriteBMPFile

WriteJPEGFile

WritePNGFile

WriteTIFFFile