ImageGear for C and C++ on Windows v19.6 - Updated
IG_image_colorspace_convert
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Colorspace Functions > IG_image_colorspace_convert

This function converts an image to the specified color space.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_image_colorspace_convert(
        HIGEAR hIGear,
        enumIGColorSpaceIDs newColorSpace,
        LPCAT_COLORSPACE_CONVERSION_OPTIONS options
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
newColorSpace enumIGColorSpaceIDs Color space to which to convert.
options LPCAT_COLORSPACE_CONVERSION_OPTIONS Conversion options (or NULL).

Return Value:

Returns the number of ImageGear errors that occurred during this function call. If there are no errors, the return value is IGE_SUCCESS.

Supported Raster Image Formats:

All pixel formats supported by ImageGear for C and C++.

Sample:

None

Example:

 
Copy Code
AT_ERRCOUNT nErrcount;  /* Number of errors on stack */
HIGEAR hImage;          /* HIGEAR handle of image */
IG_image_colorspace_convert(hImage, IG_COLOR_SPACE_ID_RGB, NULL);

Remarks:

Specify the new color space using a value from enumIGColorSpaceIDs. Argument options control the conversion flow. You may pass NULL for options if you don't want to specify any options.

For detailed information about AT_COLORSPACE_CONVERSION_OPTIONS structure and the whole color conversion process, please refer to the section Working with Color Space Conversion Engine.