ImageGear for C and C++ on Linux v20.0 - Updated
Loading and Saving
[No Target Defined] > [No Target Defined] > Common Operations > Loading and Saving

This section provides information about Loading and Saving images and documents.

Some file formats will require you to first attach a component.

Loading

To load a file "picture.bmp" from the current directory, call IG_load_file. This creates a bitmap in memory, creates a unique ImageGear handle for it, and returns this handle to you in a HIGEAR object.

C and C++
Copy Code
#include "gear.h"

HIGEAR image;
AT_ERRCOUNT errorCount;
errorCount = IG_load_file("picture.bmp", &image);   

To load from a file descriptor handle or from memory, see Loading.

Saving

To save an image to file, call IG_save_file[link to function]. It will write the content in the specified file format to the current working directory.

C and C++
Copy Code
errorCount = IG_save_file(image, "picture.tif", IG_SAVE_TIF_UNCOMP);   

To save to a file descriptor handle, or to memory, see Saving.

Additional Considerations

Some formats are handled a little differently:

For more control of loading and saving, use file filter control parameters, which are unique to each file format. See the "Getting Information about a Format Filter" and "Using File Filter Control Parameters" sections of Using File Format Filters

If it is important to minimize input/output operations, see Set the Buffer Size to Limit IO.

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