ImageGear for C and C++ on Windows v19.5 - Updated
IG_DIB_channel_count_get
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.

Declaration:

 
Copy Code
AT_INT ACCUAPI IG_DIB_channel_count_get(
        HIGDIBINFO hDIB
);

Arguments:

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

Sample:

None

Example:

 
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);

Remarks:

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.