mahnunchik / gulp-responsive

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

Select format output per image #29

Closed dandaka closed 8 years ago

dandaka commented 8 years ago

Do I understand correctly, that right now it is impossible to force output format? Say, take 10 PNG images and convert them to JPG?

Sharp has this feature http://sharp.dimens.io/en/stable/api/#toformatformat

I have tried toFormat in config JSON with no result

  gulp.src('./src/img/05OC/*.png')
    .pipe(print())
    .pipe(responsive([{
      name: '*.png',
      width: 600,
      toFormat: 'jpeg'
    }],
    {
      errorOnUnusedImage: false
    }
    ))
    .pipe(gulp.dest('./public/img/'));
});
mahnunchik commented 8 years ago

Hi @dandaka

It already works in next branch https://github.com/mahnunchik/gulp-responsive/tree/next

See format option: https://github.com/mahnunchik/gulp-responsive/blob/next/lib/config.js#L88

But it isn't documented and tested yet =(

UPD can be installed by npm install mahnunchik/gulp-responsive#next

dandaka commented 8 years ago

Works for me, thank you!