[英]Convert Bitmap to Byte Array and save it to Sqlite
如何将转换位图转换为字节数组并将其保存到Sqlite。 我正在使用C#和XAML
这是我的代码
BitmapSource image = new BitmapImage(new Uri("ms-appx:///Assets/BG.jpg", UriKind.Absolute));
using (MemoryStream ms = new MemoryStream())
{
WriteableBitmap btmMap = new WriteableBitmap
(image.PixelWidth, image.PixelHeight);
// write an image into the stream
image.Save(ms, ImageFormat.Jpeg); // error, Save and ImageFormat
}
“保存”错误:
“ Windows.UI.Xaml.Media.Imaging.BitmapSource”不包含“保存”的定义,也没有扩展方法“保存”接受类型为“ Windows.UI.Xaml.Media.Imaging.BitmapSource”的第一个参数找到(您是否缺少using指令或程序集引用?)
ImageFormat错误:
The name 'ImageFormat' does not exist in the current context
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.