mahnunchik / gulp-responsive

gulp-responsive generates images at different sizes
https://npmjs.com/gulp-responsive
MIT License
502 stars 62 forks source link

PNGs are becoming larger #34

Open mrcsmcln opened 8 years ago

mrcsmcln commented 8 years ago

Even with compressionLevel: 9, my PNGs are actually getting larger. Any way to ameliorate this?

mahnunchik commented 8 years ago

Hi @mrcsmcln

Could you please try to reproduce that behavior by underlying sharp library.

Also it would be really helpful to have system info: nodejs, OS, sharp, libvips versions.

mrcsmcln commented 8 years ago

I cannot reproduce this issue with sharp because while it is not the best at compressing (presumably for the benefit of speed), it does produce images of smaller filesizes.

Using sharp-cli with an input image 1.png of 567028 bytes, sharp --compressionLevel 9 1.png > 2.png produces 2.png, an output image of 483392 bytes. Not much of a difference, but still less than what we started with.

On the other hand, running gulp-responsive with the following options…

$.responsive({
    '**/*.png': [{}]
}, {
    quality: 100,
    progressive: true,
    compressionLevel: 9,
    errorOnUnusedConfig: false,
    errorOnUnusedImage: false,
    errorOnEnlargement: false
})

…produces an image that is 694747 bytes.

Not sure what's going on. Here's my system info:

MacBook Pro (Retina, Mid 2012) Mac OS X 10.11.3 Node.js: 5.6.0 sharp: 0.13.1 libvips: 8.2.2

mahnunchik commented 8 years ago

Hi @mrcsmcln

To have the same results as produced by sharp-cli and sharp itself you should set progressive to false.

Could you please share your example image?

mrcsmcln commented 8 years ago

I don't have the same exact image I used, but it was very similar to this one:

screen shot 2016-04-07 at 5 31 22 pm

Any idea why progressive should be set to false to achieve the same results?

mahnunchik commented 8 years ago

The same problem: #40

mahnunchik commented 8 years ago

@lovell Could you please help me with this issue? Thanks!

lovell commented 8 years ago

It's worth experimenting with withoutAdaptiveFiltering for images with large areas containing the same pixel values (this is partly how pngcrush works).

lovell commented 8 years ago

https://github.com/mahnunchik/gulp-responsive/issues/15#issuecomment-131320298

mahnunchik commented 8 years ago

@lovell Thank you!

AlexisSerneels commented 7 years ago

The 'withoutAdaptiveFiltering ' is now deprecated. Any other tip? Thx.

mahnunchik commented 7 years ago

Hi @serneelsalexis , option withoutAdaptiveFiltering is deprecated but still valid.

Next major release of gulp-responsive will be synchronized with the new sharp api and options.

3askaal commented 7 years ago

@mahnunchik when will this be ready? I like almost everything about this package but the compressed filesize is indeed almost twice the size of my source images.

3askaal commented 7 years ago

@mahnunchik setting the withoutAdaptiveFiltering option to true did exactly what I needed. Thx