GdPicture.NET.14
GdPicture14 Namespace / GdPictureImaging Class / Scale Method
GdPicture image identifier.
Scale percentage value. ie: if ScalePercent = 50, the image is reduced to half size.
A member of the Drawing2D.InterPolationMode enumeration.
Example





In This Topic
Scale Method (GdPictureImaging)
In This Topic
Resizes a GdPicture image image, keeping the same aspect ratio.
Syntax
'Declaration
 
Public Function Scale( _
   ByVal ImageID As Integer, _
   ByVal ScalePercent As Single, _
   ByVal InterpolationMode As InterpolationMode _
) As GdPictureStatus
public GdPictureStatus Scale( 
   int ImageID,
   float ScalePercent,
   InterpolationMode InterpolationMode
)
public function Scale( 
    ImageID: Integer;
    ScalePercent: Single;
    InterpolationMode: InterpolationMode
): GdPictureStatus; 
public function Scale( 
   ImageID : int,
   ScalePercent : float,
   InterpolationMode : InterpolationMode
) : GdPictureStatus;
public: GdPictureStatus Scale( 
   int ImageID,
   float ScalePercent,
   InterpolationMode InterpolationMode
) 
public:
GdPictureStatus Scale( 
   int ImageID,
   float ScalePercent,
   InterpolationMode InterpolationMode
) 

Parameters

ImageID
GdPicture image identifier.
ScalePercent
Scale percentage value. ie: if ScalePercent = 50, the image is reduced to half size.
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.
Example
Rescaling an image and saving as a png.
using (GdPictureImaging gdpictureImaging = new GdPictureImaging())
{
    int imageID = gdpictureImaging.CreateGdPictureImageFromFile("image.png", false);
    gdpictureImaging.Scale(imageID, 95.0f, System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic);
    gdpictureImaging.SaveAsPNG(imageID, "output.png");
    gdpictureImaging.ReleaseGdPictureImage(imageID);
}
See Also