我正在尝试压缩图像文件以通过网络发送,这是我的测试压缩方法
public void compress(MemoryStream inStream)
{
using (MemoryStream outStream = new MemoryStream())
{
using (DeflateStream deflate = new DeflateStream(outStream, CompressionMode.Compress, true))
{
Console.WriteLine(inStream.Length);
deflate.Write(inStream.GetBuffer(), 0, (int)inStream.Length);
deflate.Close();
Console.WriteLine(outStream.Length);
}
}
}
结果是
375531
354450
我想在压缩时至少应该得到 5 位而不是 6 位,这正常吗?我做对了吗?
提前致谢