ImageGear for C and C++ on Linux v19.10 - Updated
IG_image_colorspace_get
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image Colorspace Functions > IG_image_colorspace_get

This function gets an image's color space ID.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_image_colorspace_get(
        HIGEAR hIGear, 
        enumIGColorSpaceIDs* lpColorspace 
);

Arguments:

Name Type Description
hIGear HIGEAR HIGEAR handle of image.
lpColorspace enumIGColorSpaceIDs* Returned color space of the image.

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++.

Example:

 
Copy Code
AT_ERRCOUNT nErrcount;  /* Number of errors on stack */
HIGEAR hImage;          /* Handle of image */
enumIGColorSpaceIDs cs; /* Color space ID */
AT_BOOL bIndexed;       /* Is the image indexed? */
nErrcount = IG_image_colorspace_get(hImage, &cs);
if ((cs & IG_COLOR_SPACE_ID_ColorMask) == IG_COLOR_SPACE_ID_I)
    bIndexed = TRUE;
else
    bIndexed = FALSE;

Remarks:

An ImageGear color space ID is actually a combination of values. It contains information about 1) color channels, 2) an alpha channel, and 3) extra channels. Examine the definition of enumIGColorSpaceIDs carefully (in accucnst.h) and use bitmasks such as IG_COLOR_SPACE_ID_ColorMask to isolate the information you want.