ImageGear for C and C++ on Windows v19.10 - Updated
IG_colorspace_conversion_create_from_dib_info
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Color Space Conversion Functions > IG_colorspace_conversion_create_from_dib_info

This function creates conversion engine based on source and result color space attributes.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_colorspace_conversion_create_from_dib_info(
        HIGDIBINFO hDIB,
        enumIGColorSpaceIDs resultSpace,
        const AT_INT* resultChannelDepths,
        AT_INT resultChannelCount,
        LPCAT_COLORSPACE_CONVERSION_OPTIONS options,
        HIGCSCONVERTER* hCSConverter
);

Arguments:

Name Type Description
hDIB HIGDIBINFO DIB info handle, describes source color space.
resultSpace enumIGColorSpaceIDs Color space to which to convert.
resultChannelDepths const AT_INT* Array of channel depths in resulting color space.
resultChannelCount AT_INT Number of channels in resulting color space.
options LPCAT_COLORSPACE_CONVERSION_OPTIONS Conversion options.
hCSConverter HIGCSCONVERTER* Handle of color space converter.

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
/* Use the color space converter to convert an image 
from CMYK to 24-bit RGB, no alpha or extra channels */
AT_ERRCOUNT nErrcount;  /* Number of errors on stack */
HIGCSCONVERTER hCSConv; /* Color space converter handle */
HIGEAR hImage;          /* HIGEAR handle of image */
HIGDIBINFO hDIB;        /* Source DIB info handle */
AT_INT depths[] = { 8, 8, 8 }; /* Result channel depths */
nErrcount = IG_image_DIB_info_get(hImage, &hDIB);
nErrcount = IG_colorspace_conversion_create_from_dib_info(
    hDIB, IG_COLOR_SPACE_ID_RGB, depths, 3, NULL, &hCSConv);
nErrcount = IG_colorspace_conversion_apply_to_image(
    hCSConv, hImage);
nErrcount = IG_colorspace_conversion_destroy(hCSConv);
nErrcount = IG_DIB_info_delete(hDIB);

Remarks:

NULL is an acceptable value for resultChannelDepths. In this case the result channels will be constructed using IG_colorspace_conversion_result_channels_build() routine. The source color space attributes are taken from the specified DIB information handle. Options controls the conversion flow. You may pass NULL for Options if you don't want to specify any options.

For the 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.