Load and save bitmaps using dotnet

.net, graphics

Solution

Here's a really simple example.

Top of code file

using System.Drawing;

In code

Image test = new Bitmap("picture.bmp");
test.Save("picture.png", System.Drawing.Imaging.ImageFormat.Png);

Remember to give write permissions to the ASPNET user for the folder where the image is to be saved.

Problem

This may be simple one, but 5 mins of Googling didn't give me the answer. How do you save and load bitmaps using .Net librabries? I have an Image object and I need to save it to disk in some format (preferably png) and load back in later. A C# example would be great.

Original source