/// <summary> /// Resizes the specified image. /// </summary> /// <param name="image">The image.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="background">The background color.</param> /// <param name="imageResizeMethod">The image resize method.</param> /// <returns></returns> public static Image Resize(Image image, int width, int height, Color background, ImageResizeMethod imageResizeMethod) { switch (imageResizeMethod) { case ImageResizeMethod.FullPadding: return fullPaddingResize(image, width, height, background); case ImageResizeMethod.ScaleAndCrop: return cropResize(image, width, height, background); case ImageResizeMethod.HorizontalPadding: return paddedHorizontalResize(image, width, height, background); case ImageResizeMethod.VerticalPadding: return paddedVerticalResize(image, width, height, background); case ImageResizeMethod.ByHeight: return byHeight(image, height, background); case ImageResizeMethod.ByWidth: return byWidth(image, width, background); case ImageResizeMethod.NoPadding: return paddedNoneResize(image, width, height, background); default: throw new NotImplementedException( string.Format(CultureInfo.InvariantCulture, "Resize method {0} is not implemented.", imageResizeMethod)); } }
/// <summary> /// Resizes the specified image. /// </summary> /// <param name="image">The image.</param> /// <param name="width">The width.</param> /// <param name="height">The height.</param> /// <param name="background">The background color.</param> /// <param name="imageResizeMethod">The image resize method.</param> /// <returns></returns> public static Image Resize(Image image, int width, int height, Color background, ImageResizeMethod imageResizeMethod) { switch (imageResizeMethod) { case ImageResizeMethod.FullPadding: return(fullPaddingResize(image, width, height, background)); case ImageResizeMethod.ScaleAndCrop: return(cropResize(image, width, height, background)); case ImageResizeMethod.HorizontalPadding: return(paddedHorizontalResize(image, width, height, background)); case ImageResizeMethod.VerticalPadding: return(paddedVerticalResize(image, width, height, background)); case ImageResizeMethod.ByHeight: return(byHeight(image, height, background)); case ImageResizeMethod.ByWidth: return(byWidth(image, width, background)); case ImageResizeMethod.NoPadding: return(paddedNoneResize(image, width, height, background)); default: throw new NotImplementedException( string.Format(CultureInfo.InvariantCulture, "Resize method {0} is not implemented.", imageResizeMethod)); } }