imaqWritePNGFile

NI Vision for LabWindows/CVI Function

imaqWritePNGFile

Usage

int imaqWritePNGFile(const Image* image, const char* fileName, unsigned int compressionSpeed, const RGBValue* colorTable);

Purpose

Writes an image to a PNG file. This function stores any type of CalibrationUnit in a format that NI Vision can read. This function also converts calibration information into meters, which any PNG file reader can interpret.

Note  This function is obsolete. The replacement function is imaqWritePNGFile2(). The new function uses a new parameter called useBitDepth, which provides control over the method NI Vision uses to convert 16-bit images and unsigned 64-bit RGB images to PNG files.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_I16, IMAQ_IMAGE_RGB

Parameters

Name

Type

Description

image const Image* The image to write to a file.
fileName const char* The name of the file to write. This parameter is required and cannot be NULL.
compressionSpeed unsigned int Represents the relative speed of the compression algorithm. As this value increases, the function spends less time compressing the image. Acceptable values range from 0 to 1,000, with 750 as the default. PNG format always stores images in a lossless fashion.
colorTable const RGBValue* An optional color table to associate with 8-bit images. If you provide a color table, the table must have 256 elements. Set this parameter to NULL to write a grayscale palette to the image.

Return Value

Type

Description

int On success, this function returns a non-zero value. On failure, this function returns 0. To get extended error information, call imaqGetLastError().