imaqWritePNGFile2

NI Vision for LabWindows/CVI Function

imaqWritePNGFile2

Usage

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

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.

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_U16, IMAQ_IMAGE_I16, IMAQ_IMAGE_RGB, IMAQ_IMAGE_RGB_U64

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.
useBitDepth int When saving a signed 16-bit image to a PNG file, NI Vision must convert the data to an unsigned format and shift the data so that the most significant bit is always the leftmost bit. Set this parameter to TRUE to use the bit depth information attached to image to perform these conversions. Set this parameter to FALSE to bias the image by adding a constant value to all the pixels in the image such that the lowest negative pixel value in the image maps to zero, and then shifting the image data based on the highest pixel value in 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().