imaqWriteJPEGFile

NI Vision for LabWindows/CVI Function

imaqWriteJPEGFile

Usage

int imaqWriteJPEGFile(const Image* image, const char* fileName, unsigned int quality, void* colorTable);

Purpose

Writes an image to a JPEG file. The function also stores a CalibrationUnit of IMAQ_CENTIMETER or IMAQ_INCH only. If you pass an image to this function that has a metric CalibrationUnit other than IMAQ_CENTIMETER, the function converts xStep and yStep from the supplied unit into centimeters. If you pass an image to this function that has an English CalibrationUnit other than IMAQ_INCH, the function converts xStep and yStep from the supplied unit into inches.

Image Types Supported

IMAQ_IMAGE_U8, 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.
quality unsigned int

Represents the quality of the image. As quality increases, the function uses less lossy compression. Acceptable values range from 0 to 1,000, with 750 as the default.

Note  This function uses lossy compression even if you set the quality to 1,000.
colorTable void* Reserved. JPEG files do not support color palettes for grayscale images.

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