Reference Guide
GdPicture14 Namespace / GdPictureImaging Class / SaveAsJPEG Method / SaveAsJPEG(Int32,String) 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.

Example





In This Topic
    SaveAsJPEG(Int32,String) Method
    In This Topic
    Saves a required GdPicture image to a given file path as jpeg image.
    Syntax
    'Declaration
     
    
    Public Overloads Function SaveAsJPEG( _
       ByVal ImageID As Integer, _
       ByVal FilePath As String _
    ) As GdPictureStatus
    public GdPictureStatus SaveAsJPEG( 
       int ImageID,
       string FilePath
    )
    public function SaveAsJPEG( 
        ImageID: Integer;
        FilePath: String
    ): GdPictureStatus; 
    public function SaveAsJPEG( 
       ImageID : int,
       FilePath : String
    ) : GdPictureStatus;
    public: GdPictureStatus SaveAsJPEG( 
       int ImageID,
       string* FilePath
    ) 
    public:
    GdPictureStatus SaveAsJPEG( 
       int ImageID,
       String^ FilePath
    ) 

    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.

    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.
    Remarks
    Please note that the JPEG compression quality level used by this method is 75 by default.
    Example
    Saving jpeg images.
    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");
        gdpictureImaging.ReleaseGdPictureImage(imageID);
    }
    Drawing the red text and the black text border based on the text width and height on jpeg image.
    using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
    {
        int imageID = gdpictureImaging.CreateGdPictureImageFromFile("input.jpg");
        string text = "GdPicture.PDF";
        float width = gdpictureImaging.GetTextWidth(imageID, text, "Arial", 24, GdPicture14.FontStyle.FontStyleRegular);
        float height = gdpictureImaging.GetTextHeight(imageID, text, "Arial", 24, GdPicture14.FontStyle.FontStyleRegular);
     
        // Draw the text.
        gdpictureImaging.DrawText(imageID, text, 10, 10, 24, GdPicture14.FontStyle.FontStyleRegular, Color.Red, "Arial", true);
     
        // Draw the border rectangle.
        gdpictureImaging.DrawRectangle(imageID, 10, 10, (int)width, (int)height, 1, Color.Black, true);
     
        gdpictureImaging.SaveAsJPEG(imageID, "output.jpg");
        gdpictureImaging.ReleaseGdPictureImage(imageID);
    }
    See Also