imagemin / imagemin-pngquant

Imagemin plugin for `pngquant`
MIT License
317 stars 81 forks source link

Quality property #31

Closed FilipeQ closed 8 years ago

FilipeQ commented 8 years ago

I have this image http://dab1nmslvvntp.cloudfront.net/wp-content/uploads/2016/03/1458102922pEaSWms-1024x387.png

Code:

                       imagemin.buffer(buferImg, {
                            plugins: [                           
                                imageminPngquant({quality: '40-55'})                           
                            ]
                        }).then(function(file){
                            console.log('Optimize img...: ');

                        })

With other png images this code works, but with this image the flux never end. The code stop and don't enter on .then. the code work if i remove property quality, but i need this property. Anyone can help me why this img block my imagemin code.

Thanks.

FilipeQ commented 8 years ago

I make some tests and realized property quality don't influence image conversion, this property only decide if is generate new image?

kevva commented 8 years ago

Could you try adding a .catch block to see if it errors out somewhere?

jacqueslelezard commented 8 years ago

Hi, I got the same problem with a few images (and it work fine if I don't set any quality settings). I tried this: try { imagemin(myImagePath, getParentDirectory(myImagePath), { plugins: [ imageminPngquant({quality: '90'}) ] }).then(files => { console.log("finished!"); }); } catch(err) { console.log(err); } but it still stucks when it came to some images (always the same ones) Have you any idea what can I do to fix this? Thanks

kevva commented 8 years ago

Same with this? Notice the .catch.

imagemin.buffer(buf, {
    plugins: [imageminPngquant({quality: '40-55'})]
})
    .then(() => {
        console.log('minified');
    })
    .catch(err => {
        console.log(err);
    });
jacqueslelezard commented 8 years ago

With a .catch I got this:
Error in file: temp/OPS/widgets/step-slider-oceans-influence-climate/images/NGL_ES_G5_Earth_116-117_poster.png Command failed: /pathOfMyProject/node_modules/imagemin-pngquant/node_modules/pngquant-bin/vendor/pngquant --output /var/folders/q7/vgqkvn0n62l2rxhbcp_plbx80000gn/T/a66c5775-abee-4163-8b59-d2e2ac88c226 /var/folders/q7/vgqkvn0n62l2rxhbcp_plbx80000gn/T/9f1dd948-b9cd-463b-8d17-9f5c962180e7 --quality 85-90 ] killed: false, code: 99, signal: null, cmd: '/pathOfMyProject/node_modules/imagemin-pngquant/node_modules/pngquant-bin/vendor/pngquant --output /var/folders/q7/vgqkvn0n62l2rxhbcp_plbx80000gn/T/a66c5775-abee-4163-8b59-d2e2ac88c226 /var/folders/q7/vgqkvn0n62l2rxhbcp_plbx80000gn/T/9f1dd948-b9cd-463b-8d17-9f5c962180e7 --quality 85-90', stdout: '', stderr: '' }
By the way I didn't used .buffer let me know if it can impact...

kevva commented 8 years ago

Adjust your quality option. https://github.com/pornel/pngquant#--quality-min-max.