Enum ResizeType

ResizeType enumeration

Specifies the resize type.

public enum ResizeType

Values

NameValueDescription
None0The pixels are not preserved during resize operation.
LeftTopToLeftTop1Left top point of the new image will coincide with the left top point of the original image. Crop will occur if required.
RightTopToRightTop2Right top point of the new image will coincide with the right top point of the original image. Crop will occur if required.
RightBottomToRightBottom3Right bottom point of the new image will coincide with the right bottom point of the original image. Crop will occur if required.
LeftBottomToLeftBottom4Left bottom point of the new image will coincide with the left bottom point of the original image. Crop will occur if required.
CenterToCenter5Center of the new image will coincide with the center of the original image. Crop will occur if required.
LanczosResample6Resample using lanczos algorithm with a=3.
NearestNeighbourResample7Resample using nearest neighbour algorithm.
AdaptiveResample8Resample using adaptive algorithm based on weighted and blended rational function and lanczos3 interpolation algorithms.
BilinearResample9Resample using bilinear interpolation. Image pre-filtering is allowed to remove the noice before resample, when needed
HighQualityResample10The high quality resample
CatmullRom11The Catmull-Rom cubic interpolation method.
CubicConvolution12The Cubic Convolution interpolation method
CubicBSpline13The CubicBSpline cubic interpolation method
Mitchell14The Mitchell cubic interpolation method
SinC15The Sinc (Lanczos3) cubic interpolation method
Bell16The Bell interpolation method

Examples

Resize image using specific Resize Type.

[C#]

using (var image = Image.Load("Photo.jpg"))
{
    image.Resize(640, 480, ResizeType.CatmullRom);
    image.Save("ResizedPhoto.jpg");

    image.Resize(1024, 768, ResizeType.CubicConvolution);
    image.Save("ResizedPhoto2.jpg");

    var resizeSettings = new ImageResizeSettings
    {
        Mode = ResizeType.CubicBSpline,
        FilterType = ImageFilterType.SmallRectangular
    };

    image.Resize(800, 800, resizeSettings);
    image.Save("ResizedPhoto3.jpg");
}

This example loads an image and resizes it using various resizing methods.

[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.Resize(image.Width* 2, image.Height* 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.Resize(image.Width / 2, image.Height / 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.Resize(image.Width* 2, image.Height* 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.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.BilinearResample);
    image.Save(dir + "downsample.bilinear.gif");
}

See Also