CSharp examples for System.Drawing.Imaging:Bitmap
Resize Image
using System.Drawing.Drawing2D; using System.Drawing.Imaging; using System.Drawing; using System.IO;// w w w . j av a2 s .c o m using System.Collections; using System; public class Main{ public static Bitmap ResizeImage(Bitmap bmp, int newW, int newH) { try { Bitmap bap = new Bitmap(newW, newH); Graphics g = Graphics.FromImage(bap); g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic; g.DrawImage(bap, new Rectangle(0, 0, newW, newH), new Rectangle(0, 0, bap.Width, bap.Height), GraphicsUnit.Pixel); g.Dispose(); return bap; } catch { return null; } } }