我尝试将位图压缩成Jpeg格式,但似乎唯一可以传递给Compress的流是System.IO流。
System.IO.Stream s = new System.IO.Stream();
bmpObj.Compress(Bitmap.CompressFormat.Jpeg, 100, s);做这件事的正确方法是什么?使用哪种流?
发布于 2019-04-23 00:15:18
Stream是一个抽象类-您需要使用像MemoryStream或FileStream这样的具体实例
using (System.IO.Stream outStream = System.IO.File.Create(targetFile))
{
bmpObj.Compress(Bitmap.CompressFormat.Png, 100, outStream);
}https://stackoverflow.com/questions/55797375
复制相似问题