Reference Guide
GdPicture14 Namespace / GdPictureImaging Class / SaveAsJPEG Method / SaveAsJPEG(Int32,String,Int32,Boolean) Method
A unique image identifier of the GdPicture image representing the image to be saved.
The file path where the specified image will be saved. Use the empty string to allow the control to prompt users to select a file. If the specified file already exists, it will be overwritten.

You can subsequently use the GetLastPath method to retrieve the path of the selected file.

The compression quality level from 0 to 100. 0 means the worst quality and the best compression, 100 means the best quality and the worst compression. The default value is 75.
Set this parameter to true to save the image as a progressive JPEG, otherwise set it to false. The default value is false.
Example





In This Topic
    SaveAsJPEG(Int32,String,Int32,Boolean) Method
    In This Topic
    Saves a required GdPicture image to a given file path as jpeg image. You can specify additional JPEG parameters for saving using this method.
    Syntax
    'Declaration
     
    
    Public Overloads Function SaveAsJPEG( _
       ByVal ImageID As Integer, _
       ByVal FilePath As String, _
       ByVal Quality As Integer, _
       ByVal Progressive As Boolean _
    ) As GdPictureStatus
    public GdPictureStatus SaveAsJPEG( 
       int ImageID,
       string FilePath,
       int Quality,
       bool Progressive
    )
    public function SaveAsJPEG( 
        ImageID: Integer;
        FilePath: String;
        Quality: Integer;
        Progressive: Boolean
    ): GdPictureStatus; 
    public function SaveAsJPEG( 
       ImageID : int,
       FilePath : String,
       Quality : int,
       Progressive : boolean
    ) : GdPictureStatus;
    public: GdPictureStatus SaveAsJPEG( 
       int ImageID,
       string* FilePath,
       int Quality,
       bool Progressive
    ) 
    public:
    GdPictureStatus SaveAsJPEG( 
       int ImageID,
       String^ FilePath,
       int Quality,
       bool Progressive
    ) 

    Parameters

    ImageID
    A unique image identifier of the GdPicture image representing the image to be saved.
    FilePath
    The file path where the specified image will be saved. Use the empty string to allow the control to prompt users to select a file. If the specified file already exists, it will be overwritten.

    You can subsequently use the GetLastPath method to retrieve the path of the selected file.

    Quality
    The compression quality level from 0 to 100. 0 means the worst quality and the best compression, 100 means the best quality and the worst compression. The default value is 75.
    Progressive
    Set this parameter to true to save the image as a progressive JPEG, otherwise set it to false. The default value is false.

    Return Value

    A member of the GdPictureStatus enumeration. If the method has been successfully followed, then the return value is GdPictureStatus.OK. We strongly recommend always checking this status first.
    Example
    Performing a negative effect on a jpeg image.
    using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
    {
        // LoadInMemory parameter is set to true in order to be able to update the input file.
        int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.jpg", true);
        gdpictureImaging.FxNegative(imageID);
        gdpictureImaging.SaveAsJPEG(imageID, "image.jpg", 75, true);
        gdpictureImaging.ReleaseGdPictureImage(imageID);
    }
    See Also