ImageGear Professional v18.2 > User Guide > Using ImageGear > Loading and Saving Images > Saving Images > Saving Images to a Disk File |
Copy Code
|
|
---|---|
IG_save_file(HIGEAR hIGear, lpszFileName, lFormatType) |
IG_save_file is the function normally used to save a HIGEAR image to disk. The name of the file to which to save is specified with the second argument, and the format type and compression type (if applicable) in which to save it is specified in the third. If the file format being used supports more than one compression type, more than one constant will be available. The BMP format, for example, is provided with two values for lformatType: IG_SAVE_BMP_UNCOMP and IG_SAVE_BMP_RLE.
The file accucnst.h defines the constants to which lFormatType may be set. These constants are also listed at the end of File Format Reference.
If the file already exists, and the format supports multiple pages, IG_save_file() will append the new image(s) to the file. If the file already exists and it is a single image format type, the file will be overwritten.
The following code example demonstrates the use of IG_save_file():
Copy Code
|
|
---|---|
HIGEAR hIGear; /* handle ret'd by IG_load_... */ AT_ERRCOUNT nErrcount; /* # of errors on stack */ AT_LMODE lFormatType; /* format type to save to */ /*set format and compression to an AT_LMODE constant */ lFormatType = IG_SAVE_TIF_UNCOMP; nErrcount = IG_save_file(hIGear, "picture.tif", lFormatType); |
If you do not know the file format, you may set lFormatType to IG_SAVE_UNKNOWN. ImageGear will check the file's extension and save the image accordingly. If you set lFormatType to a value other than IG_SAVE_UNKNOWN, ImageGear assumes that you are specifying the correct type and saves the image accordingly.
Before selecting a file format to which to save, you can reference the section entitled ImageGear Supported Bit Depths to ensure that you save to a format that supports the same bit depth as the original image.