I need a deep copy of bitmap from another bitmap. Now, most of the solutions say something like this, which is not a deep copy. Meaning that when I lock the
You can use like this it is smaller and more elegant way.
public static Bitmap GetCopyOf(Bitmap originalImage)
{
Bitmap copy = new Bitmap(originalImage.Width, originalImage.Height);
using (Graphics graphics = Graphics.FromImage(copy))
{
Rectangle imageRectangle = new Rectangle(0, 0, copy.Width, copy.Height);
graphics.DrawImage( originalImage, imageRectangle, imageRectangle, GraphicsUnit.Pixel);
}
return copy;
}