Enum ResizeType
Tên không gian: Aspose.Imaging Tổng hợp: Aspose.Imaging.dll (25.4.0)
Đánh giá loại resize.
public enum ResizeType
Fields
AdaptiveResample = 8
Mô tả bằng cách sử dụng thuật toán thích ứng dựa trên chức năng hợp lý cân và pha trộn và thuật toán interpolation lanczos3.
Bell = 16
Phương pháp Bell Interpolation
BilinearResample = 9
Resample sử dụng interpolation hai chiều. hình ảnh trước lọc được cho phép để loại bỏ tiếng ồn trước khi resample, khi cần thiết
CatmullRom = 11
Phương pháp Interpolation Cubic Catmull-Rom
CenterToCenter = 5
Trung tâm của hình ảnh mới sẽ phù hợp với trung tâm của hình ảnh ban đầu.
CubicBSpline = 13
Phương pháp interpolation CubicBSpline
CubicConvolution = 12
Phương pháp Interpolation Cubic Convolution
HighQualityResample = 10
Mẫu chất lượng cao
LanczosResample = 6
Sử dụng thuật toán lanczos với a=3.
LeftBottomToLeftBottom = 4
Điểm dưới bên trái của hình ảnh mới sẽ trùng với Điểm dưới bên trái của hình ảnh ban đầu.
LeftTopToLeftTop = 1
Điểm trên trái của hình ảnh mới sẽ trùng với Điểm trên trái của hình ảnh ban đầu.
Mitchell = 14
Phương pháp Mitchell Cubic Interpolation
NearestNeighbourResample = 7
Sử dụng thuật toán hàng xóm gần nhất
None = 0
Các pixel không được bảo quản trong quá trình hoạt động khôi phục.
RightBottomToRightBottom = 3
Điểm dưới bên phải của hình ảnh mới sẽ trùng với Điểm dưới bên phải của hình ảnh ban đầu.
RightTopToRightTop = 2
Điểm trên chính của hình ảnh mới sẽ trùng với Điểm trên chính của hình ảnh ban đầu.
SinC = 15
Phương pháp Interpolation Cube của Sinc (Lanczos3)
Examples
Tạo lại hình ảnh bằng cách sử dụng kiểu Resize cụ thể.
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");
}
Ví dụ này tải một hình ảnh và resize nó bằng cách sử dụng các phương pháp resizing khác nhau.
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");
}