- string fileName = "image.jpg";
- System.Drawing.Image img = System.Drawing.Image.FromFile(fileName);
- Bitmap bmp = img as Bitmap;
- /** Crop the image, start from X=50, Y=50, Width=150, Height=150 **/
- Bitmap cropBmp = bmp.Clone(new Rectangle(50, 50, 150, 150), bmp.PixelFormat);
- cropBmp.Save("new_file_name.jpg");
- cropBmp.Dispose();
- bmp.Dispose();
- img.Dispose();
No comments:
Post a Comment