ProcessImage() public method

Processes the image.
public ProcessImage ( ImageFactory factory ) : Image
factory ImageFactory /// The current instance of the class containing /// the image to process. ///
return Image
Ejemplo n.º 1
0
        /// <summary>
        /// Resizes the current image to the given dimensions.
        /// </summary>
        /// <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 ImageFactory Resize(Size size)
        {
            if (this.ShouldProcess)
            {
                int width = size.Width;
                int height = size.Height;

                var resizeSettings = new Dictionary<string, string> { { "MaxWidth", width.ToString("G") }, { "MaxHeight", height.ToString("G") } };

                Resize resize = new Resize { DynamicParameter = new Size(width, height), Settings = resizeSettings };

                this.Image = resize.ProcessImage(this);
            }

            return this;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Resizes the current image to the given dimensions.
        /// </summary>
        /// <param name="resizeLayer">
        /// The <see cref="ResizeLayer"/> containing the properties required to resize the image.
        /// </param>
        /// <returns>
        /// The current instance of the <see cref="T:ImageProcessor.ImageFactory"/> class.
        /// </returns>
        public ImageFactory Resize(ResizeLayer resizeLayer)
        {
            if (this.ShouldProcess)
            {
                var resizeSettings = new Dictionary<string, string> { { "MaxWidth", resizeLayer.Size.Width.ToString("G") }, { "MaxHeight", resizeLayer.Size.Height.ToString("G") } };

                Resize resize = new Resize { DynamicParameter = resizeLayer, Settings = resizeSettings };

                this.Image = resize.ProcessImage(this);
            }

            return this;
        }