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

This function returns the width, height, and number of Bits Per Pixel, from the DIB of the image indicated by handle hIGear.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_image_dimensions_get(
       HIGEAR hIGear,
       LPAT_DIMENSION lpWidth,
       LPAT_DIMENSION lpHeight,
       LPUINT lpBitsPerPixel
);

Arguments:

Name Type Description
hIGear HIGEAR ImageGear handle of image.
lpWidth LPAT_DIMENSION Pointer to a variable which will receive image width (number of pixels per row).
lpHeight LPAT_DIMENSION Pointer to a variable which will receive image height (number of rows).
lpBitsPerPixel LPUINT Pointer to a variable which will receive image bit depth (number of Bits Per Pixel).

Return Value:

Returns the number of ImageGear errors that occurred during this function call.

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 hIGear;          // Handle of image
AT_DIMENSION nWidth, nHeight;  // Will hold returned width and height
UINT nBpp;                // Will hold returned bits per pixel

// Load image file "picture.bmp" from working directory
nErrcount = IG_load_file("picture.bmp", &hIGear);
if(nErrcount == 0)
{
    nErrcount = IG_image_dimensions_get(hIGear, &nWidth, &nHeight, &nBpp);
    // ...
    // Destroy the image
    IG_image_delete(hIGear);
}

Remarks:

"Bits per Pixel" parameter does not uniquely identify the image pixel format. For example, a 8-bits per channel CMYK image and a 8-bits per channel RGBA image will have the same "Bits per Pixel" value of 32. Please use IG_image_channel_count_get, IG_image_channel_depth_get, IG_image_channel_depths_get, IG_image_colorspace_get or IG_image_DIB_info_get to obtain more specific information.