ImageGear Professional DLL v18.1 for Windows
IG_image_is_gray
Send Feedback
ImageGear Professional v18.1 > API Reference Guide > Core Component API Reference > Core Component Functions Reference > General Image Functions > IG_image_is_gray

Glossary Item Box

This function is called to determine if an image is a grayscale image.

Declaration:

  Copy Code
AT_ERRCOUNT ACCUAPI IG_image_is_gray(
       HIGEAR hIGear,
       LPAT_BOOL lpIsImageGray
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
lpIsImageGray LPAT_BOOL Pointer to a variable which will be overwritten with TRUE if the image is grayscale, and with FALSE if it is not grayscale.

Return Value:

Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

All pixel formats supported by ImageGear Professional.

Sample:

Medical, Timing, FlashPix

Example:

  Copy Code
AT_ERRCOUNT nErrcount;  // Number of errors on stack
HIGEAR hIGear;          // Handle of image
AT_BOOL bItsGray;        // Will be set = TRUE if grayscale

// Load image file "picture.bmp" from working directory
nErrcount = IG_load_file("picture.bmp", &hIGear);
if(nErrcount == 0)
{
    nErrcount = IG_image_is_gray(hIGear, &bItsGray);
    // ...
    // Destroy the image
    IG_image_delete(hIGear);
}

Remarks:

The function considers the image to be grayscale, if either of the following is true:

FALSE is returned for all 1-bit indexed images, even if the palette contains two shades of gray.

©2014. Accusoft Corporation. All Rights Reserved.