Declaration: Frm2DImg.SaveImage(ImgHandle: integer; FName: string; Width, Height: integer; IncludeColScl: boolean; BgColor: TColor; Caption: string): integer;
Saves the image specified by the handle ImgHandle. The image handle has a valid range of 0 to 16. The handle 0 refers to the main image of the 2D Imager, the handles 1 to 16 to the special images (if available). The parameter FName specifies the filename of the stored image. Currently the following file types are supported: BMP, JPG and PNG. If FName is left empty the image is copied to the clipboard. The parameters Width and Height control the extents of the image (in pixels). Setting either Width or Height to zero forces an automatic adjustment of that dimension to comply with the aspect ratio of the data. The parameter IncludeColScl determines whether the corresponding color scale is included or not. The color scale is displayed below the image. The background color of both the plot and the color scale is defined by the parameter BgColor. The Caption is displayed above the image at the right edge. If Caption is left empty, the default caption of the 2D Imager is used instead.

Please note that the Width and the Height parameters relate to the data area of the image (without the scales and labels). Depending on the IncludeColScl parameter the size of the stored image is (Width+70) x (Height+88) if IncludeColScl is TRUE or (Width+70) x (Height+58) if FALSE.

The function returns the following error codes:

 0 ... everything OK
-1 ... the image handle is invalid or points to a non-existing image
-2 ... invalid file format (currently only BMP, PNG, JPG files are supported)
-3 ... invalid width and/or height