Sai*_*ait 13 c# wpf writeablebitmap
我有:
WriteableBitmap bmp;
Run Code Online (Sandbox Code Playgroud)
我基本上想将它保存到磁盘上的文件中,如下所示:
C:\bmp.png
Run Code Online (Sandbox Code Playgroud)
我读了一些提到阅读的论坛:
bmp.Pixels
Run Code Online (Sandbox Code Playgroud)
并将这些像素保存到Bitmap
当时使用的Bitmap.SaveImage()
函数中.但是,我无法访问任何Pixels
.显然我的WriteableBitmap
名字没有任何属性Pixels
.
我使用.NET Framework 4.0.
Ind*_*000 33
使用WriteableBitmap的克隆并使用以下函数:
CreateThumbnail(filename, _frontBitmap.Clone());
Run Code Online (Sandbox Code Playgroud)
...
void CreateThumbnail(string filename, BitmapSource image5)
{
if (filename != string.Empty)
{
using (FileStream stream5 = new FileStream(filename, FileMode.Create))
{
PngBitmapEncoder encoder5 = new PngBitmapEncoder();
encoder5.Frames.Add(BitmapFrame.Create(image5));
encoder5.Save(stream5);
}
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
19246 次 |
最近记录: |