PNG adaptiveFiltering is slow
See original GitHub issueResize of png file (2048x2048 to 1920) is very slow, takes more than 6 seconds on (4gb ram and 2 vCPUs) CPU Optimized Droplet of Digital Ocean.
The code:
sharp(file.Body).resize({ width: 1920 }).png({ progressive:true, adaptiveFiltering:true }).toBuffer()
Versions and cache:
{ cairo: '1.16.0',
croco: '0.6.12',
exif: '0.6.21',
expat: '2.2.6',
ffi: '3.2.1',
fontconfig: '2.13.1',
freetype: '2.10.0',
fribidi: '1.0.5',
gdkpixbuf: '2.36.12',
gettext: '0.19.8.1',
gif: '5.1.4',
glib: '2.56.4',
gsf: '1.14.45',
harfbuzz: '2.3.1',
jpeg: '2.0.2',
lcms: '2.9',
orc: '0.4.28',
pango: '1.42.4',
pixman: '0.38.0',
png: '1.6.34',
svg: '2.45.5',
tiff: '4.0.10',
uuid: '2.33.1',
vips: '8.7.4',
webp: '1.0.2',
xml: '2.9.9',
zlib: '1.2.11' }
{ memory: { current: 0, high: 0, max: 50 },
files: { current: 0, max: 20 },
items: { current: 0, max: 100 } }
Some help to improve the resize time?
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Compression and Filtering (PNG: The Definitive Guide)
Filtering is a method of reversibly transforming the image data so that the main compression engine can operate more efficiently. As a simple...
Read more >PNG Specification: Rationale - W3C
PNG includes filtering capability because filtering can significantly reduce the compressed size of truecolor and grayscale images. Filtering is also sometimes ...
Read more >Chapter 9. Compression and Filtering - PNG - O'Reilly
Filtering is a method of reversibly transforming the image data so that the main compression engine can operate more efficiently. As a simple...
Read more >Incredibly slow PNG saving - 2.5 minutes!
I'm saving a fairly small image (3000x3300) as PNG and it's taking 2.5 minutes! That's insane! My CPU sits at 100% the entire...
Read more >ImageMagick: Lossless max compression for PNG?
For photos of natural landscapes an "adaptive" filtering ( -quality 05 ) is generally ... PNG compression tends to be rather slow because...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You’ll need to experiment - good luck!
@lovell Thanks. I will disabling adaptiveFiltering for now.
About the PNG lossless optimization, what you recommend, to get the min size and the same quality with Sharp?