PNG resize = large file sizes
See original GitHub issueHi!
I’m migrating from Intervention image library to Sharp and have run into a snag. My PNG resizes are substantially larger via Sharp, compared to Intervention, which is using Imagemagick under the hood.
I’ve tried all the PNG settings available in Sharp, but still can’t get anywhere close. Hopefully I’m just missing something?
Here are two PNG images, with alpha channel intact, resized from 2k or so down to 1024x1024.
Sharp is about 590KB, and Imagemagick is about 360KB!
Intervention code I’m using
Image->orientate()->fit(1024, 1024)->encode('png')
and Sharp is:
sharp().resize(1024, 1024).ignoreAspectRatio().png({ adaptiveFiltering: true })
adaptiveFiltering off seems to increase the file size even more on certain files, so I’ve left it on.
Any suggestions on how to get a comparative file size using Sharp??
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Thanks, and yup, read that area, but I wasn’t aware what the various PNG input types are. So that’s the cause then. Hopefully this clears it up for anyone else who isn’t so versed on what indexed PNG input is as well!
@victorkurauchi Please open a new issue, ensuring you’ve read https://sharp.pixelplumbing.com/api-output#png especially