ImageGear Professional for Linux
Converting Images from One File Format to Another

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. Be sure, however, that the bit depth of the original file can be supported by the new format type. To help you with this, we have provided you with a Format Bit Depths table in the section entitled ImageGear Supported Bit Depths.

The following is an example in which a Windows Bitmap file (BMP) is converted to a TIFF file (.TIF):

 
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 Core Component API Function Reference.

In order to save an image using ImageGear, it must have a HIGEAR handle. If your image is in DIB format, use: IG_image_DIB_import() or IG_image_create_DIB_ex() to assign it a HIGEAR handle. If the image is a DDB, use IG_dspl_DDB_import().

 

 

 


©2016. Accusoft Corporation. All Rights Reserved.

Send Feedback