imaqReadFile

NI Vision for LabWindows/CVI Function

imaqReadFile

Usage

int imaqReadFile(Image* image, const char* fileName, RGBValue* colorTable, int* numColors);

Purpose

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

Image Types Supported

IMAQ_IMAGE_U8, IMAQ_IMAGE_U16, IMAQ_IMAGE_I16, IMAQ_IMAGE_SGL, IMAQ_IMAGE_COMPLEX, IMAQ_IMAGE_RGB, IMAQ_IMAGE_HSL, IMAQ_IMAGE_RGB_U64

Parameters

Name

Type

Description

image Image* The image in which the function stores data it reads from the file.
fileName const char* The name of the file to read. This parameter is required and cannot be NULL.
colorTable RGBValue* An optional array of up to 256 elements. If the file has a color table, the function fills this parameter with the color table values. If the file does not contain a color table, the function returns an empty array. Set this parameter to NULL if you do not want the function to load the color table.
numColors int* If colorTable is not NULL, the function fills this parameter with the number of colors in the color table. If colorTable is NULL, the function ignores this parameter. Set this parameter to NULL if you do not need this information.

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().