Image.ResizeWidthProportionally

ResizeWidthProportionally(int)

Resizes the width proportionally. The default NearestNeighbourResample is used.

public void ResizeWidthProportionally(int newWidth)
ParameterTypeDescription
newWidthInt32The new width.

See Also


ResizeWidthProportionally(int, ResizeType)

Resizes the width proportionally.

public virtual void ResizeWidthProportionally(int newWidth, ResizeType resizeType)
ParameterTypeDescription
newWidthInt32The new width.
resizeTypeResizeTypeType of the resize.

Examples

This example loads an image and resizes it proportionally using various resizing methods. Only the width is specified, the height is calculated automatically.

[C#]

string dir = "c:\\temp\\";

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
    // Scale up by 2 times using Nearest Neighbour resampling.
    image.ResizeWidthProportionally(image.Width* 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
    image.Save(dir + "upsample.nearestneighbour.gif");
}

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
    // Scale down by 2 times using Nearest Neighbour resampling.
    image.ResizeWidthProportionally(image.Width / 2, Aspose.Imaging.ResizeType.NearestNeighbourResample);
    image.Save(dir + "downsample.nearestneighbour.gif");
}

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
    // Scale up by 2 times using Bilinear resampling.
    image.ResizeWidthProportionally(image.Width* 2, Aspose.Imaging.ResizeType.BilinearResample);
    image.Save(dir + "upsample.bilinear.gif");
}

using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
{
    // Scale down by 2 times using Bilinear resampling.
    image.ResizeWidthProportionally(image.Width / 2, Aspose.Imaging.ResizeType.BilinearResample);
    image.Save(dir + "downsample.bilinear.gif");
}

See Also


ResizeWidthProportionally(int, ImageResizeSettings)

Resizes the width proportionally.

public virtual void ResizeWidthProportionally(int newWidth, ImageResizeSettings settings)
ParameterTypeDescription
newWidthInt32The new width.
settingsImageResizeSettingsThe image resize settings.

See Also