ImageGear for C and C++ on Linux v18.8 - Updated
IG_image_DIB_export_size_calc
API Reference Guide > Core Component API Reference > Core Component Functions Reference > Image DIB Functions > IG_image_DIB_export_size_calc

This function calculates the size of the exported DIB for an image.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_image_DIB_export_size_calc(
   const HIGEAR hIGear,
   AT_INT* lpDIBSize,
   const AT_DIB_EXPORT_OPTIONS* lpOptions
);

Arguments:

Name Type Description
hIGear const HIGEAR HIGEAR handle of image for which to calculate exported DIB size.
lpDIBSize AT_INT* Pointer to where exported DIB size will be stored.
lpOptions const AT_DIB_EXPORT_OPTIONS* Export options. See IG_image_DIB_export for details.

Return Value:

Returns 0 if successful. Otherwise, returns the number of ImageGear errors that occurred during this function call.

Supported Raster Image Formats:

If lpOptions->Format is IG_DIB_EXPORT_FORMAT_WINDOWS:

If lpOptions->Format is IG_DIB_EXPORT_FORMAT_IG_LEGACY:

Example:

 
Copy Code
AT_ERRCOUNT nErrcount;  // Number of errors on stack
HIGEAR hIGear;          // Handle of image
AT_INT nDibSize;        // Exported DIB size
AT_DIB_EXPORT_OPTIONS Options; // Options for DIB export

// Load image file "picture.bmp" from working directory
nErrcount = IG_load_file("picture.bmp", &hIGear);
if(nErrcount == 0)
{
    // Get exported DIB size, allocate memory buffer and export DIB
    memset(&Options, 0, sizeof(AT_DIB_EXPORT_OPTIONS));
    Options.Format = IG_DIB_EXPORT_FORMAT_IG_LEGACY;
    Options.UseAlpha = FALSE;
    IG_image_DIB_export_size_calc(hIGear, &nDibSize, &Options);
    // ...
}
// Destroy the image
IG_image_delete(hIGear);

Remarks:

Use this function to calculate the minimal buffer size required to export a DIB with IG_image_DIB_export.