ImageGear for C and C++ on Windows v19.1 - Updated
IG_DIB_bit_depth_get
API Reference Guide > Core Component API Reference > Core Component Functions Reference > DIB Functions > IG_DIB_bit_depth_get

This function returns the bit depth of an image, which is the sum of the channel bit depths.

Declaration:

 
Copy Code
AT_INT ACCUAPI IG_DIB_bit_depth_get(
        HIGDIBINFO hDIB
);

Arguments:

Name Type Description
hDIB HIGDIBINFO DIB info handle.

Return Value:

Returns image bit depth.

Supported Raster Image Formats:

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

Sample:

Annotation, Load Callback, Thumbnail, MFC PDF Demo

Example:

 
Copy Code
AT_ERRCOUNT nErrcount;  /* Number of errors on stack */
HIGDIBINFO hDIBInfo;    /* DIB info handle */
HIGEAR hImage;          /* HIGEAR handle of image */
AT_INT imageDepth;      /* Returned bit depth of image */
nErrcount = IG_image_DIB_info_get(hImage, &hDIBInfo);
imageDepth = IG_DIB_bit_depth_get(hDIBInfo);

Remarks:

For example, if the image is a simple 24-bit RGB image, this function will return 24. If it's a 24-bit RGB image with an 8-bit alpha channel, this function will return 32.