Enum ResizeType

Enum ResizeType

Namespace: Aspose.Imaging
Assembly: Aspose.Imaging.dll (25.7.0)

Specifies the resize type.

public enum ResizeType
   {
      None,
      FitToPageWidth,
      FitToPageHeight,
      Percent,
      Pixels,
      Auto,
      Custom
   }

Fields

AdaptiveResample = 8

Resample using adaptive algorithm based on weighted and blended rational function and lanczos3 interpolation algorithms.

Bell = 16

The Bell interpolation method

BilinearResample = 9

Resample using bilinear interpolation. Image pre-filtering is allowed to remove the noice before resample, when needed

CatmullRom = 11

The Catmull-Rom cubic interpolation method.

CenterToCenter = 5

Center of the new image will coincide with the center of the original image. Crop will occur if required.

CubicBSpline = 13

The CubicBSpline cubic interpolation method

CubicConvolution = 12

The Cubic Convolution interpolation method

HighQualityResample = 10

The high quality resample

LanczosResample = 6

Resample using lanczos algorithm with a=3.

LeftBottomToLeftBottom = 4

Left bottom point of the new image will coincide with the left bottom point of the original image. Crop will occur if required.

LeftTopToLeftTop = 1

Left top point of the new image will coincide with the left top point of the original image. Crop will occur if required.

Mitchell = 14

The Mitchell cubic interpolation method

NearestNeighbourResample = 7

Resample using nearest neighbour algorithm.

None = 0

The pixels are not preserved during resize operation.

RightBottomToRightBottom = 3

Right bottom point of the new image will coincide with the right bottom point of the original image. Crop will occur if required.

RightTopToRightTop = 2

Right top point of the new image will coincide with the right top point of the original image. Crop will occur if required.

SinC = 15

The Sinc (Lanczos3) cubic interpolation method

Examples

Resize image using specific Resize Type.

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.

string dir = "c:\\temp\\";
   using (Aspose.Imaging.Image image = Aspose.Imaging.Image.Load(dir + "sample.gif"))
   {
       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"))
   {
       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"))
   {
       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"))
   {
       image.Resize(image.Width / 2, image.Height / 2, Aspose.Imaging.ResizeType.BilinearResample);
       image.Save(dir + "downsample.bilinear.gif");
   }
 English