FreeImage.SaveEx Method (FIBITMAP, String, FREE_IMAGE_FORMAT, FREE_IMAGE_SAVE_FLAGS, FREE_IMAGE_COLOR_DEPTH, Boolean)

FreeImage.NET

FreeImageSaveEx Method (FIBITMAP, String, FREE_IMAGE_FORMAT, FREE_IMAGE_SAVE_FLAGS, FREE_IMAGE_COLOR_DEPTH, Boolean)
Saves a previously loaded FreeImage bitmap to a file. In case the loading format is FIF_UNKNOWN the format is taken off the filename. If no suitable format was found false will be returned. Save flags can be provided by the flags parameter. The bitmaps color depth can be set by 'colorDepth'. If set to FICD_AUTO a suitable color depth will be taken if available.

Namespace: FreeImageAPI
Assembly: FreeImageNET (in FreeImageNET.dll) Version: 3.17.0.4 (3.17.0)
Syntax
C#
public static bool SaveEx(
	ref FIBITMAP dib,
	string filename,
	FREE_IMAGE_FORMAT format,
	FREE_IMAGE_SAVE_FLAGS flags,
	FREE_IMAGE_COLOR_DEPTH colorDepth,
	bool unloadSource
)

Parameters

dib
Type: FreeImageAPIFIBITMAP
Handle to a FreeImage bitmap.
filename
Type: SystemString
The complete name of the file to save to. The extension will be corrected if it is no valid extension for the selected format or if no extension was specified.
format
Type: FreeImageAPIFREE_IMAGE_FORMAT
Format of the image. If the format should be taken from the filename use FIF_UNKNOWN.
flags
Type: FreeImageAPIFREE_IMAGE_SAVE_FLAGS
Flags to enable or disable plugin-features.
colorDepth
Type: FreeImageAPIFREE_IMAGE_COLOR_DEPTH
The new color depth of the bitmap. Set to FICD_AUTO if Save should take the best suitable color depth. If a color depth is selected that the provided format cannot write an error-message will be thrown.
unloadSource
Type: SystemBoolean
When true the structure will be unloaded on success. If the function failed and returned false, the bitmap was not unloaded.

Return Value

Type: Boolean
Returns true on success, false on failure.
Exceptions
ExceptionCondition
ArgumentException A direct color conversion failed.
ArgumentNullExceptiondib or filename is null.
See Also