ImageGear for C and C++ on Windows v20.5 - Updated
LPFNIG_BATCH_BEFORE_SAVE
API Reference Guide > Core Component API Reference > Core Component Callback Functions Reference > LPFNIG_BATCH_BEFORE_SAVE

LPFNIG_BATCH_BEFORE_SAVE is called before an image file is saved, allowing you to correct and image before saving.

Declaration:

 
Copy Code
typedef AT_BOOL (LPACCUAPI LPFNIG_BATCH_BEFORE_SAVE)(
        LPVOID lpPrivate, 
        HIGEAR hIGear, 
        UINT nPageNumber
);

Arguments:

Name Type Description
lpPrivate LPVOID Far pointer to private data area.
hIGear HIGEAR HIGEAR handle to the image.
nPageNumber UINT This variable is set to the number of pages to be saved.

Return Value:

Reserved (must always be TRUE).

Supported Raster Image Formats:

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

Sample:

None

Example:

 
Copy Code
// DLL
// User's BatchBeforeSave CB
AT_BOOL MyBatchBeforeSave(
        LPVOID         lpPrivate,   /* Private data passed in     */
        HIGEAR         hIGear,               /* ImageGear image handle     */
        UINT           nPageNumber           /* Number of page to be saved */
   )
{
        // Convert bpp to 1 before saving
        UINT bits_per_pixel;
        IG_image_dimensions_get(hIGear, NULL, NULL, & bits_per_pixel);
        If(bits_per_pixel != 1)
        {
                IG_IP_color_reduce_bayer(hIGear, 1, NULL);
}
        return TRUE;
}
// Register BatchBeforeSave CB
IG_batch_CB_register(MyBatchBeforeSave, IG_BATCHCB_BEFORE_SAVE, this);

Remarks:

For example, you might want to rotate an image before saving.

Multipage documents can be saved as a set of different files if the flag IG_BATCH_MP_TO_MP is not specified.

Is this page helpful?
Yes No
Thanks for your feedback.