GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / Resize Method
GdPicture image identifier.
New image width in pixel.
New image height in pixel.
A member of the Drawing2D.InterPolationMode enumeration.
Example





In This Topic
Resize Method (GdPictureImaging)
In This Topic
Resizes a GdPicture image.
Syntax
'Declaration
 
Public Function Resize( _
   ByVal ImageID As Integer, _
   ByVal NewImageWidth As Integer, _
   ByVal NewImageHeight As Integer, _
   ByVal InterpolationMode As InterpolationMode _
) As GdPictureStatus
public GdPictureStatus Resize( 
   int ImageID,
   int NewImageWidth,
   int NewImageHeight,
   InterpolationMode InterpolationMode
)
public function Resize( 
    ImageID: Integer;
    NewImageWidth: Integer;
    NewImageHeight: Integer;
    InterpolationMode: InterpolationMode
): GdPictureStatus; 
public function Resize( 
   ImageID : int,
   NewImageWidth : int,
   NewImageHeight : int,
   InterpolationMode : InterpolationMode
) : GdPictureStatus;
public: GdPictureStatus Resize( 
   int ImageID,
   int NewImageWidth,
   int NewImageHeight,
   InterpolationMode InterpolationMode
) 
public:
GdPictureStatus Resize( 
   int ImageID,
   int NewImageWidth,
   int NewImageHeight,
   InterpolationMode InterpolationMode
) 

Parameters

ImageID
GdPicture image identifier.
NewImageWidth
New image width in pixel.
NewImageHeight
New image height in pixel.
InterpolationMode
A member of the Drawing2D.InterPolationMode enumeration.

Return Value

A member of the GdPictureStatus enumeration.
Remarks
This method automatically adjusts the vertical and horizontal image resolution in order to maintain the aspect ratio. If the intention is to change the aspect ratio, the SetVerticalResolution() and/or SetHorizontalResolution() methods should be used instead.

This method requires the Image Documents component to run.

Example
Resizing a 1920x1080 pixels image to a 1080x720 pixels image.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image_1920x1080.jpg", false);
 
    // Set the new dimensions for your image.
    int newImageWidth = 1080;
    int newImageHeight = 720;
 
    // Resize the image.
    gdpictureImaging.Resize(imageID, newImageWidth, newImageHeight, System.Drawing.Drawing2D.InterpolationMode.Default);
    gdpictureImaging.SaveAsJPEG(imageID, "image_1080x720.jpg");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also