I'm trying to use the type JpegBitmapEncoder
in the name space System.Windows.Media.Imaging
, but i can't seem to use it. The namespace itself is available and i can use it but for some reason the JpegBitmapEncoder is not there... How can i use it?
问问题
655 次
1 回答
1
也许您可以使用WritableBitmap上的扩展方法来加载和保存 jpeg。
如果要从图像中获取字节数组,请使用 aMemoryStream
及其ToArray
获取数据。
MemoryStream stream = new MemoryStream();
image.SaveJpeg(stream, width, height, 0, 80);
stream.Position = 0;
byte[] buffer = stream.ToArray();
于 2012-08-22T17:41:37.883 回答