public static Image Resize(this Image imgSource, ImageResizeType type, int width, int height) { if (type == ImageResizeType.Scale) { return(ImageResizer.GetResizedImage(imgSource, width, height)); } if (type == ImageResizeType.Croped) { return(ImageResizer.GetCropedImage(imgSource, width, height)); } return(null); }
private static ResizerBase GetResizer(Image img, ImageResizeType type) { switch (type) { case ImageResizeType.Crop: return new CropResizer(img); case ImageResizeType.BestSize:return new BestSizeResizer(img); case ImageResizeType.Default: return new DefaultResizer(img); } throw new ArgumentOutOfRangeException("type"); }