zhangyuanwei / node-images

Cross-platform image decoder(png/jpeg/gif) and encoder(png/jpeg) for Nodejs
https://npmjs.org/package/images
MIT License
1.55k stars 204 forks source link

The compressed result of png is larger than the source file #235

Open Azer1205 opened 3 years ago

Azer1205 commented 3 years ago

对图片进行宽高不变的压缩时,如果结果类型时png类型,压缩结果的大小会比原图片还大。

oxUnd commented 3 years ago

这个不是用来压缩的呀? 你的意思是,原图啥都不做,弄出来比原来的大是吧?

iuws commented 2 years ago

是的,什么都不做,会比原图大 Images(sourceImageBuffer).save(savePath)

oxUnd commented 2 years ago

因为图片解码出来再编码,由于编码跟以前可能不太一样了,所以导致这个差异。 这块没有太追求一致性。主要的原因是这个库主要还是弄图片合并、裁切等功能。 可以搭配上图片压缩工具做一下大小处理。

具体这个问题我记下,有时间看看。

wyj-5 @.***> 于2021年11月22日周一 下午5:55写道:

是的,什么都不做,会比原图大 Images(sourceImageBuffer).save(savePath)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/zhangyuanwei/node-images/issues/235#issuecomment-975346383, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE2DG5GEG34SLEXFN23HP3UNIHPZANCNFSM5CHJX6NA .