Converting a file from one file format to another is simply a matter of loading a file from disk using IG_load_file() or other load function, and then saving it with a new format type. However, make sure that the bit depth of the original file can be supported by the new format type - see Format Bit Depths for a complete delineation of the bit depths supported by each format.
The following example demonstrates converting a Windows Bitmap file (BMP) to a TIFF file:
|
Copy Code
|
HIGEAR hIGear; /* HIGEAR handle returned */
AT_ERRCOUNT nErrcount; /* # of errors on stack */
AT_LMODE lFormatType; /* format to save to */
/* Set name of BMP file to load and format to save to */
lFormatType = IG_SAVE_TIF_UNCOMP;
/* Load picture.bmp, obtaining ImageGear handle of image */
nErrcount = IG_load_file("picture.bmp", &hIGear);
if (nErrcount == 0 ) /* If successful: */
{
/* save image as a TIFF file: */
nErrcount = IG_save_file(hIGear, "picture.tif", lFormatType );
}
|
If the file named "picture.tif" already exists, the image will be appended to "picture.tif" because TIFF supports multiple images in a single file.
For more information on the ImageGear IG_save_...() functions, see Save Functions.