PNGs generated with gulp using imageminPngquant +

2019-08-26 05:30发布

问题:

I have the following gulp code for png minification:

function images() {
  return gulp.src([folder.preimages+'/**/*.png'])
    .pipe(cache(imagemin([
      //png
      imageminPngquant({
          speed: 1,
          quality: [0.95, 1] //lossy settings
      }),
      imageminZopfli({
          more: true
          // iterations: 50 // very slow but more effective
      })
    ])))
    .pipe(gulp.dest(folder.public_img));
}

The end result is a very nicely compressed png with a low file size. It works fine on Edge, Chrome, Firefox, but when I try to open it on MacOS Safari it just doesn't open the image.

I found this question, but it involves the libraries directly and I am not sure if I could modify them in my case. In this case I am using what's provided with npm. Is there an alternative I could use for this minification process? I do need it to be lossy.