WriteFile Method

NI Vision for Visual Basic

WriteFile Method

Syntax

CWIMAQVision.WriteFile SourceImage, Path, Format [, ColorTable]

Return Type

Long

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

Purpose

Obsolete—Use WriteImage instead. 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 TypesImage Types
AIPDall image types
BMP, JPEG8-bit, RGB
PNG, TIFF8-bit, 16-bit, RGB, RGBU64

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.

ColorTable As Variant

[Optional] An optional color table to associate with 8-bit images. If you want to provide a color table, the table must have 256 elements. Do not provide this input to write a grayscale palette to the file.

Example

Private Sub Run_Click()
    Dim Filename As String
    Dim ColorTable(0 To 255) As Long
    
    'Write an image in Viewer1 to a JPEG file.
    'The name of the file is in Filename.
    CWIMAQVision1.WriteFile CWIMAQViewer1.Image, Filename, _
                            cwimaqFileJPEG
End Sub

See Also

WriteImage