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?
这可能很简单,但5分钟的谷歌搜索没有给我答案。如何使用.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.
我有一个Image对象,我需要以某种格式(最好是png)将其保存到磁盘并在以后加载。一个C#的例子会很棒。
3 个解决方案
#1
12
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.
请记住为要保存图像的文件夹的ASPNET用户授予写入权限。
#2
1
Hiya, use the Image.Save() method.
Hiya,使用Image.Save()方法。
A better explanation and code sample than I could provide can be found here:
可以在这里找到比我能提供的更好的解释和代码示例:
#3
0
About 10 seconds of google lead me to this example for the save method, you can dig around a bit more for the others.
大约10秒的谷歌引导我使用保存方法的这个例子,你可以为其他人挖掘更多。
#1
12
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.
请记住为要保存图像的文件夹的ASPNET用户授予写入权限。
#2
1
Hiya, use the Image.Save() method.
Hiya,使用Image.Save()方法。
A better explanation and code sample than I could provide can be found here:
可以在这里找到比我能提供的更好的解释和代码示例:
#3
0
About 10 seconds of google lead me to this example for the save method, you can dig around a bit more for the others.
大约10秒的谷歌引导我使用保存方法的这个例子,你可以为其他人挖掘更多。