Skip to main content

Posts

Showing posts from August, 2016

Image Resizer using C#.NET Windows Application

Code to Resize Image (with Sample Application) In this post I am sharing the code to resize an image using C#.NET. Also sharing the code to preview and save resized image in multiple formats (jpeg, bmp, png, gif, tiff). Code to Resize Image for given width and height public static Bitmap ResizeImage(Image image, int width, int height) { var destRect = new Rectangle(0, 0, width, height); var destImage = new Bitmap(width, height); destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution); using ( var graphics = Graphics.FromImage(destImage)) { graphics.CompositingMode = CompositingMode.SourceCopy; graphics.CompositingQuality = CompositingQuality.HighQuality; graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; graphics.SmoothingMode = SmoothingMode.HighQuality;