ImageGear for C and C++ on Linux v20.0 - Updated
API Reference Guide > Core Component API Reference > Core Component Functions Reference > DIB Functions > IG_DIB_channel_count_get

This function returns the number of channels in the image.


Copy Code
AT_INT ACCUAPI IG_DIB_channel_count_get(


Name Type Description
hDIB HIGDIBINFO DIB info handle.

Return Value:

Returns the number of channels in the image.

Supported Raster Image Formats:

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


Copy Code
AT_ERRCOUNT nErrcount;  /* Number of errors on stack */
HIGDIBINFO hDIBInfo;    /* DIB info handle */
HIGEAR hImage;          /* HIGEAR handle of image */
AT_INT nChannels;       /* Returned number of channels */
nErrcount = IG_image_DIB_info_get(hImage, &hDIBInfo);
nChannels = IG_DIB_channel_count_get(hDIBInfo);


For example, a typical 24-bit RGB image has three 8-bit channels (red, green, blue) so this function will return 3. For a 24-bit RGB image with a single alpha channel, this function would return 4.

Is this page helpful?
Yes No
Thanks for your feedback.