public override void ProcessImage(ref ImageFactory imageFactory) { var image = imageFactory.Image; var size = new Size(image.Size.Width, image.Size.Height); var doubleSize = new Size(size.Width * 2, size.Height * 2); imageFactory.Resize(doubleSize); imageFactory.ContentAwareResize(size); }
/// <summary> /// Resizes the current image to the given dimensions using Content Aware Resizing. /// </summary> /// <param name="factory"> /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class /// that this method extends. /// </param> /// <param name="size"> /// The <see cref="T:System.Drawing.Size"/> containing the width and height to set the image to. /// </param> /// <returns> /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class. /// </returns> public static ImageFactory ContentAwareResize(this ImageFactory factory, Size size) { if (factory.ShouldProcess) { int width = size.Width; int height = size.Height; ContentAwareResizeLayer resizeLayer = new ContentAwareResizeLayer(new Size(width, height)); return(factory.ContentAwareResize(resizeLayer)); } return(factory); }