hello i am abit new i开发者_JAVA百科n wpf and i have been trying to save an image to afile with no success. thanks in advance for your help.
If you want to save it as a PNG for example, you can do something like:
using (var fileStream = new FileStream(filePath, FileMode.Create))
{
BitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(BitmapFrame.Create(image));
encoder.Save(fileStream);
}
Or you can use some other encoders derived from the BitmapEncoder class.
精彩评论