ImageGear for C and C++ on Windows v19.6 - Updated
IG_image_create_empty
API Reference Guide > Core Component API Reference > Core Component Functions Reference > General Image Functions > IG_image_create_empty

This function creates a new empty image that does not have pixel data allocated.

Declaration:

 
Copy Code
AT_ERRCOUNT ACCUAPI IG_image_create_empty(
       HIGDIBINFO hDIB,
       HIGEAR* lphIGear
);

Arguments:

Name Type Description
hDIB HIGDIBINFO DIB info object with parameters used to create image.
lphIGear HIGEAR* Returned HIGEAR handle of created image.

Return Value:

Returns 0 if successful. Otherwise, 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++.

Sample:

Medical

Example:

 
Copy Code
    // Create a new image with the same parameters as an existing image,
    // but with no pixel data allocated 
    AT_ERRCOUNT nErrcount;  // Number of errors on stack
    HIGEAR hIGear;          // Handle of image
    HIGDIBINFO hDIB;        // DIB info handle of image
    HIGEAR hIGearCreated;   // Handle of created image

    // Load image file "picture.bmp" from working directory
    nErrcount = IG_load_file("picture.bmp", &hIGear);
    if(nErrcount == 0)
    {
        // Get DIB info of the existion image
        // DIB info can be also created and filled in manually
        nErrcount = IG_image_DIB_info_get(hIGear, &hDIB);
        if(nErrcount == 0)
        {
            nErrcount = IG_image_create_empty(hDIB, &hIGearCreated);
            // Destroy DIB info 
            IG_DIB_info_delete(hDIB);
            // ...
            // Destroy the image
            IG_image_delete(hIGearCreated);
        }
        // Destroy the source image
        IG_image_delete(hIGear);
    }