ResizeWidthRatio Method (GdPictureImaging)
Resizes a GdPicture image with custom width keeping the original aspect ratio for the new height
value.
Parameters
- ImageID
- GdPicture image identifier.
- NewImageWidth
- The new image width in pixel.
- InterpolationMode
- A member of the Drawing2D.InterPolationMode enumeration.
Return Value
A member of the GdPictureStatus enumeration.
Resizing the image making it twice the original size.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("input.png");
// Resize the image making its width twice larger. The height of the image will be changed in order to maintain the aspect ratio.
int width = gdpictureImaging.GetWidth(imageID);
gdpictureImaging.ResizeWidthRatio(imageID, width * 2, System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic);
gdpictureImaging.SaveAsPNG(imageID, "output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
}