ResizeHeightRatio Method (GdPictureImaging)
In This Topic
Resizes a GdPicture image with custom height keeping the original aspect ratio for the new width
value.
Syntax
'Declaration
Public Function ResizeHeightRatio( _
ByVal As Integer, _
ByVal As Integer, _
ByVal As InterpolationMode _
) As GdPictureStatus
public GdPictureStatus ResizeHeightRatio(
int ,
int ,
InterpolationMode
)
public function ResizeHeightRatio(
: Integer;
: Integer;
: InterpolationMode
): GdPictureStatus;
public function ResizeHeightRatio(
: int,
: int,
: InterpolationMode
) : GdPictureStatus;
public: GdPictureStatus ResizeHeightRatio(
int ,
int ,
InterpolationMode
)
public:
GdPictureStatus ResizeHeightRatio(
int ,
int ,
InterpolationMode
)
Parameters
- ImageID
- GdPicture image identifier.
- NewImageHeight
- The new height of the image in pixel.
- InterpolationMode
- A member of the Drawing2D.InterPolationMode enumeration.
Return Value
A member of the GdPictureStatus enumeration.
Example
Resizing the image making it half the original size.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("input.png");
// Resize the image making its height half. The width of the image will be changed in order to maintain the aspect ratio.
int height = gdpictureImaging.GetHeight(imageID);
gdpictureImaging.ResizeHeightRatio(imageID, height / 2, System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic);
gdpictureImaging.SaveAsPNG(imageID, "output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
Example
Resizing the image making it half the original size.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
int imageID = gdpictureImaging.CreateGdPictureImageFromFile("input.png");
// Resize the image making its height half. The width of the image will be changed in order to maintain the aspect ratio.
int height = gdpictureImaging.GetHeight(imageID);
gdpictureImaging.ResizeHeightRatio(imageID, height / 2, System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic);
gdpictureImaging.SaveAsPNG(imageID, "output.png");
gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also