ReadImage Method

NI Vision for Visual Basic

ReadImage Method

Syntax

CWIMAQVision.ReadImage DestImage, Path [, ColorPalette]

Return Type

Long

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

Purpose

Reads image information from a file. The file can be in one of the following formats: PNG, JPEG, JPEG2000, TIFF, AIPD, or BMP.

Remarks

You can use this method with all image types.

This method does not read overlay information, calibration information, custom data, or pattern matching template information from the file. To read this data, use ReadImageAndVisionInfo.

Parameters

DestImage As CWIMAQImage

The image into which the method stores data it reads from the file.

Path As String

The complete path name, including drive, directory, and filename, for the file to be loaded.

ColorPalette As Variant

[Optional] On return, a CWIMAQPalette object containing the color palette that the method read from the file if the table exists.

Example

Private Sub Run_Click()
    Dim path As String
    Dim i As New CWIMAQImage
    
    ' Read a file and the associated color palette and
    ' store it in the image in viewer1.
    CWIMAQVision1.ReadImage CWIMAQViewer1.Image, path, _
                            CWIMAQViewer1.Palette
End Sub

Read Image Example

See Also

WriteImage

ReadImageAndVisionInfo