question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PNG resize = large file sizes

See original GitHub issue

Hi!

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!

imagemagik sharp

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:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
timothyallancommented, Oct 4, 2018

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!

0reactions
lovellcommented, Aug 7, 2020

@victorkurauchi Please open a new issue, ensuring you’ve read https://sharp.pixelplumbing.com/api-output#png especially

Some of these options require the use of a globally-installed libvips compiled with support for libimagequant (GPL).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Resize PNG Online - Resizing.app
Resize PNG images in Windows 10 · Go to Paint and open your file from the drop-down menu. · Click the Resize tool...
Read more >
Free PNG Image Resizer: Resize PNGs Online | Adobe Express
Change PNG sizes easily and for free with the Adobe Express PNG image resizer. Simply upload your photo, resize it, and download your...
Read more >
Free Online Resize PNG Images with High output Quality
First, you need to add a PNG image file: drag & drop your PNG image file or click inside the white area to...
Read more >
TinyPNG – Compress WebP, PNG and JPEG images ...
What does TinyPNG do? ... TinyPNG uses smart lossy compression techniques to reduce the file size of your WEBP, JPEG and PNG files....
Read more >
Resize PNG | Free Online PNG Image Resizer - XConvert
How to resize PNG images online? ... Click and select or Drag and drop your PNG files to dark blue box. Once you...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found