Reputation: 1691
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.
Upvotes: 2
Views: 2522
Reputation: 34679
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.
Upvotes: 12
Reputation: 3842
Hiya, use the Image.Save() method.
A better explanation and code sample than I could provide can be found here:
Upvotes: 1
Reputation: 63126
About 10 seconds of google lead me to this example for the save method, you can dig around a bit more for the others.
Upvotes: 0