[C#]
using (Bitmap pic = (Bitmap)Bitmap.FromFile(Server.MapPath("rez/joel-filipe-_AjqGGafofE-unsplash.jpg"))) {
RectangleF rect = pic.Bounds;
rect.Inflate(-50, -100);
using (Bitmap crop = pic.Clone(rect, PixelFormat.Format32bppArgb)) {
crop.Save(Server.MapPath("IG8_Bitmap_Clone.jpg"));
}
}
Here we make a clone of a portion of an existing Bitmap. The
input and output files are shown below.
joel-filipe-_AjqGGafofE-unsplash.jpg
IG8_Bitmap_Clone.jpg
|