ImageGear Professional v18.2 > API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Processing Functions > IG_IP_convert_to_gray |
This function converts the image referenced by hIGear to a grayscale image.
Copy Code
|
|
---|---|
AT_ERRCOUNT ACCUAPI IG_IP_convert_to_gray( HIGEAR hIGear); |
Name | Type | Description |
hIGear | HIGEAR | HIGEAR handle of image. |
All pixel formats supported by ImageGear Professional.
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); } |
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.