我嘗試將位圖壓縮為 Jpeg,但似乎我可以傳遞的唯一流Compress是System.IO流。System.IO.Stream s = new System.IO.Stream();
bmpObj.Compress(Bitmap.CompressFormat.Jpeg, 100, s);這樣做的正確方法是什么,使用哪個流?
1 回答

三國紛爭
TA貢獻1804條經驗 獲得超7個贊
Stream是一個抽象類——你需要使用一個具體的實例,比如MemoryStreamorFileStream
using (System.IO.Stream outStream = System.IO.File.Create(targetFile))
{
bmpObj.Compress(Bitmap.CompressFormat.Png, 100, outStream);
}
- 1 回答
- 0 關注
- 83 瀏覽
添加回答
舉報
0/150
提交
取消