WriteableBitmap与stream的转化
using(Stream stream = new MemoryStream())
{
WriteableBitmap headerJpg = new WriteableBitmap((buttonAddHeader.Background as ImageBrush).ImageSource as BitmapImage);
Extensions.SaveJpeg(headerJpg, stream, headerJpg.PixelWidth, headerJpg.PixelHeight, 0, 80);
WriteableBitmap headerJpg1 = new WriteableBitmap(200, 200);
Extensions.LoadJpeg(headerJpg1, stream);
}
为何上面的代码抛异常?
去掉Extensions.LoadJpeg(headerJpg1, stream);这行代码后就没有异常。
求大神帮助!
[解决办法]
异常信息??
[解决办法]
显然,保证 stream不为空,同时是jpg格式