ImageGear Professional DLL v17.1 for Windows Accusoft
IG_IP_convert_to_gray
Send Feedback  
ImageGear Professional DLL v17.1 for Windows > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Effects Functions > IG_IP_convert_to_gray

Glossary Item Box

This function converts the image referenced by hIGear to a grayscale image.

Declaration:

  Copy Code
AT_ERRCOUNT ACCUAPI IG_IP_convert_to_gray(
   HIGEAR hIGear
);

Arguments:

hIGear HIGEAR handle of image.

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:

Color, Image Processing, FlashPix, FreqIP, Color

Example:

  Copy Code
HIGEAR hIGear;            // HIGEAR handle of the image
AT_ERRCOUNT nErrcount;    // Count of errs on stack upon ret from func

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

Remarks:

The function changes image color space to IG_COLOR_SPACE_ID_Gy. The bit depth of the resulting image will be equal to the maximal channel depth of the source image. If the original image has an Alpha or Pre-multiplied Alpha channel, the image will be blended over a black background to produce the resulting image. If the original image has Extra channels, they will be removed.

©2012. Accusoft Corporation. All Rights Reserved.