using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication1 public static Bitmap cropAtRect(this Bitmap b, Rectangle r) { Bitmap nb = new Bitmap(r.Width, r.Height); Graphics g = Graphics.FromImage(nb); g.DrawImage(b, -r.X, -r.Y); return nb; }