Expand/Shrink

IupLoadImage

Definition: include pGUI.e

Ihandln ih = IupLoadImage(string filename)
Description: filename: Name of the file to be loaded.

Returns: the identifier of the created image, or NULL if an error occurs. When it fails the global attribute "IUPIM_LASTERROR" is set with a message describing the error.
pwa/p2js: Not supported
Auxillary Functions Native Handle to imImage
imImage result = IupGetNativeHandleImage(atom handle)

handle: image native handle, ie:
In Win32 is a HANDLE of a DIB.
In GTK is a GdkPixbuf*.
In Motif is a Pixmap.
Its memory is released after the imImage is created.

Returns: the imImage handle. Useful when pasting data from an IupClipboard.

imImage to Native Handle
atom result = IupGetImageNativeHandle(imImage image)

image: the imImage handle. Must be a bitmap image.

Returns: the image native handle, ie:
In Win32 is a HANDLE for a DIB.
In GTK is a GdkPixbuf*.
In Motif is a Pixmap.
Usefull when copying data to an IupClipboard.

imImage to IupImage (since 3.10)
Ihandle ih = IupImageFromImImage(imImage image)

image: the imImage handle. Must be a bitmap image.

Returns: an Ihandle handle, specifically as per IupImage().

IupImage to imImage (since 3.22)
imImage ih = IupImageToImImage(Ihandle image)

image: an Ihandle. Must be a bitmap image, specifically as per IupImage().

Returns: the imImage handle.

Save an IupImage
object res = IupSaveImage(Ihandle ih, string file_name, string fmt)

ih: handle of the IupImage.
file_name: Name of the file to be loaded.
format: format descriptor for IM. For example: "BMP", "JPEG", "GIF", "TIFF", "PNG", "PNM", "PCX", "ICO", etc.

Returns: 1 on success, otherwise a string message describing the error.

Save an IupImage as text
object res = IupSaveImageAsText(Ihandle ih, string file_name, string fmt, string name)

Saves the IupImage as a text file to be reused in other programs.

ih: handle of the IupImage.
file_name: Name of the file to be loaded.
fmt: text format. Can be: "LED", "LUA" or "C".
name: name of the image. Can be NULL.

It does NOT depend on the IM library.

Returns: 1 on success, otherwise a string message describing the error.

Notes: If name is NULL and the IupImage is associated with a name then that name is used, if no name is associated then "image" will be used.

IupImage from name (since 3.28)
Ihandln res = IupImageGetHandle(string name)

It does NOT depend on the IM library.

name: name of the image.

Returns: an IupImage handle from a name or NULL if failed.

Name can be a global name set with IupSetHandle, or the name of a stock image from IupImageLib.
In this case the function just returns the existing element.

Name can also be the a file name that will be loaded from disk.
But the available file formats supported are system dependent.
The Windows driver supports BMP.
The GTK driver supports the formats supported by the GDK-PixBuf library, such as BMP, GIF, JPEG, PCX, PNG, TIFF and many others.
The Motif driver supports the X-Windows bitmap.
In this case the function returns a new image handle and associates the name with that handle, so in the next call it will returns the existing handle.

Name can also be the name of a resource image defined in a RC file in Windows.
In this case the function returns a new image handle and associates the name with that handle, so in the next call it will returns the existing handle.