IUP-Go Documentation 4.0

IupImageSave

Saves an IupImage to a file using native driver image encoding.

Parameters/Return

int IupImageSave(Ihandle* ih, const char* filename, const char* format);

ih: handle of the image (created with IupImage, IupImageRGB, IupImageRGBA, or returned by IupDrawGetImage/IupImageGetHandle).

filename: file path to save to.

format: image format string: "PNG", "JPEG", or "BMP". Can be NULL to auto-detect from the filename extension.

Returns: 1 on success, 0 on failure.

Notes

The image is encoded using the native GUI toolkit, with no external library dependencies. Supported formats are platform-dependent:

If format is NULL, the format is detected from the filename extension (.png, .jpg/.jpeg, .bmp).

JPEG quality defaults to 85 and can be configured with IupSetGlobal("IMAGESAVEQUALITY", "90"), where the value is 0-100.

All image types are supported: 8-bit indexed (palette is expanded), 24-bit RGB, and 32-bit RGBA.

See Also

IupImageSaveToBuffer, IupImageGetHandle, IupImage, IupDrawGetImage