WriteTIFFFile Method

NI Vision for Visual Basic

WriteTIFFFile Method

Syntax

CWIMAQVision.WriteTIFFFile SourceImage, Path [, TIFFFileOptions = cwimaqTIFFCompressionNone] [, ColorPalette]

Return Type

Long

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

Purpose

Writes an image to a file in TIFF format.

Remarks

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

Parameters

SourceImage As CWIMAQImage

The image to write to a file.

Path As String

The name of the file.

TIFFFileOptions As Variant

[Optional] Options to use when writing the file. You can set this parameter to one of two different types of values. Set this parameter to a compression method if you want to write a compressed TIFF file. If you want to specify further options, set this parameter to a CWIMAQTIFFFileOptions object.

This parameter has a default value of cwimaqTIFFCompressionNone.

ColorPalette As Variant

[Optional] A color table to associate with U8 images. The default is a grayscale palette. If the color table has less than 256 elements, the function fills the remaining elements with grayscale values to increase the size of the color table to 256 elements. This parameter is ignored if the CompressionMethod is cwimaqTIFFCompressionJPEG.

Example

Dim Filename1 As String
Dim Filename2 As String
Dim Filename3 As String
Dim TiffOptions As New CWIMAQTIFFFileOptions

'Write an image in Viewer1 to an uncompressed TIFF file.
'The name of the file is in Filename1
CWIMAQVision1.WriteTIFFFile CWIMAQViewer1.Image, Filename1

'Write an image in Viewer1 to a TIFF file with ZIP compression
'The name of the file is in Filename2
CWIMAQVision1.WriteTIFFFile CWIMAQViewer1.Image, Filename2, cwimaqTIFFCompressionZip

'Write an image in Viewer1 to an TIFF file with the following options
'Compression Method = cwimaqTIFFCompressionRunLength
'Photometric Interpretation = cwimaqPhotometricWhiteIsZero
'The name of the file is in Filename3
TiffOptions.CompressionMethod = cwimaqTIFFCompressionRunLength
TiffOptions.Photometric = cwimaqPhotometricWhiteIsZero
CWIMAQVision1.WriteTIFFFile CWIMAQViewer1.Image, Filename3, TiffOptions, CWIMAQViewer1.Palette

See Also

CWIMAQTIFFFileOptions

ReadImage

WriteImageAndVisionInfo

WriteBMPFile

WriteJPEGFile

WriteJPEG2000File

WritePNGFile