/// <summary>
        ///     Resize the image to the specified width and height.
        /// </summary>
        /// <param name="image">The image to resize.</param>
        /// <param name="width">The width to resize to.</param>
        /// <param name="height">The height to resize to.</param>
        /// <param name="drawSettings">The draw settings for image to resize to.</param>
        /// <returns>The resized image.</returns>
        public static Bitmap ResizeImage(Image image, int width, int height, DrawSettings drawSettings = null)
        {
            //a holder for the result
            var result = new Bitmap(width, height);

            //set the resolutions the same to avoid cropping due to resolution differences
            result.SetResolution(image.HorizontalResolution, image.VerticalResolution);

            var ds = drawSettings ?? new DrawSettings();

            //use a graphics object to draw the resized image into the bitmap
            using (var graphics = Graphics.FromImage(result))
            {
                //set the resize quality modes to high quality
                graphics.CompositingQuality = ds.CompositingQuality;
                graphics.InterpolationMode  = ds.InterpolationMode;
                graphics.SmoothingMode      = ds.SmoothingMode;
                //draw the image into the target bitmap
                graphics.DrawImage(image, 0, 0, result.Width, result.Height);
            }

            //return the resulting bitmap
            return(result);
        }
 /// <summary>
 ///     Resize the image to the specified width and height.
 /// </summary>
 /// <param name="image">The image to resize.</param>
 /// <param name="size">The size to resize to.</param>
 /// <param name="drawSettings">The draw settings for image to resize to.</param>
 /// <returns>The resized image.</returns>
 public static Bitmap ResizeImage(Image image, Size size, DrawSettings drawSettings = null)
 {
     return(ResizeImage(image, size.Width, size.Height, drawSettings));
 }