VintaSoft Imaging .NET SDK 12.4: Documentation for .NET developer
Vintasoft.Imaging Namespace / VintasoftImage Class / Save Methods / Save(String) Method
Syntax Exceptions Remarks Example Requirements SeeAlso
In This Topic
    Save(String) Method (VintasoftImage)
    In This Topic
    Saves this VintasoftImage object to the specified file.
    Syntax
    'Declaration
    
    Public Overloads Sub Save( _
    ByVal filename
    Filename where the image should be saved.
    As System.String _
    )
    public void Save(
    System.String filename
    )
    public: void Save(
    System.String filename
    )
    public:
    void Save(
    System.String filename
    )

    Parameters

    filename
    Filename where the image should be saved.
    Exceptions
    ExceptionDescription
    Thrown if filename is null.
    Thrown if encoder is not found for specified file extension or error occurs at saving the image.
    Remarks

    Supported image formats: BMP, GIF, JBIG2, JPEG, PCX, PDF, PNG, TIFF.

    Suitable encoder is selected automatically from the extension of the filename, exception is thrown if encoder is not found for file extension specified in filename.

    If image is saving to new file (filename != SourceInfo.Filename) this method:

    • saves image to new BMP/GIF/JBIG2/JPEG/PCX/PDF/PNG/TIFF file

    If image is saving to the source file (filename == SourceInfo.Filename) this method:
    • saves image to the source BMP/GIF/JBIG2/JPEG/PCX/PDF/PNG/TIFF file if image is changed (IsChanged = true) and source file contains only one image
    • throws an exception if image is saved to the source GIF/JBIG2/PDF/TIFF file, image is changed (IsChanged = true) and source file contains some images
    • throws an exception if image is saved to the source image file and image is not changed (IsChanged = false)

    Example

    This C#/VB.NET code shows how to load image from TIFF file and save it as JPEG file.

    
    ' load image from file
    Using image As New Vintasoft.Imaging.VintasoftImage("c:\original-image.tif")
        ' save image to the file
        image.Save("c:\converted-image.jpg")
    End Using
    
    
    
    // load image from file
    using (Vintasoft.Imaging.VintasoftImage image =
        new Vintasoft.Imaging.VintasoftImage(@"c:\original-image.tif"))
    {
        // save image to the file
        image.Save(@"c:\converted-image.jpg");
    }
    
    

    Requirements

    Target Platforms: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    See Also