IGxImage.SaveToFile

Syntax

SaveToFile(FileName: String);

Parameters

FileName - file, to which the image is saved.

Description

The SaveToFile method saves the image to file.

Comments

If the file already exists, it is rewritten. The file is saved in the initial format. To change the format, use the SaveToFileEncoded method. Use the RawFormat property to check the format.

Example

Sub UserProc;
Var
    Img: IGxImage;
    Format: IGxImageFormat;
Begin
    Img := ImageBox1.Image;
    Format := Img.RawFormat;
    If Format = GxImageFormats.Bmp Then
        Img.SaveToFile("c:\New_Image.Bmp");
    Elseif Format = GxImageFormats.Emf Then
        Img.SaveToFile("c:\New_Image.Emf");
    Elseif Format = GxImageFormats.Gif Then
        Img.SaveToFile("c:\New_Image.Gif");
    Elseif Format = GxImageFormats.Icon Then
        Img.SaveToFile("c:\New_Image.Ico");
    Elseif Format = GxImageFormats.Jpeg Then
        Img.SaveToFile("c:\New_Image.Jpeg");
    Elseif Format = GxImageFormats.MemoryBmp Then
        Img.SaveToFile("c:\New_Image.Bmp");
    Elseif Format = GxImageFormats.Png Then
        Img.SaveToFile("c:\New_Image.Png");
    Elseif Format = GxImageFormats.Tiff Then
        Img.SaveToFile("c:\New_Image.Tiff");
    Elseif Format = GxImageFormats.Wmf Then
        Img.SaveToFile("c:\New_Image.Wmf");
    End If;
End Sub UserProc;

After executing the example clicking the button saves the image that is stored in the ImageBox1 component to the 1.bmp file.

See also:

IGxImage