// Load an image from a file Image image = Image.FromFile("example.jpg"); // Do some processing with the image // Dispose of the image to free up memory image.Dispose();
// Create a new bitmap Bitmap bitmap = new Bitmap(200, 200); // Do some processing with the bitmap // Dispose of the bitmap to free up memory bitmap.Dispose();In this example, a new bitmap is created using the `Bitmap` constructor. The bitmap is then processed in some way, and finally disposed of using the `Dispose` method to free up memory. The System.Drawing namespace is part of the .NET Framework, which is a package library provided by Microsoft.