derhuerst / gulp-scale-images

Gulp plugin to resize each image into multiple smaller variants.
https://github.com/derhuerst/gulp-scale-images#gulp-scale-images
ISC License
13 stars 5 forks source link

Quality option #12

Closed VitaliyR closed 5 years ago

VitaliyR commented 5 years ago

Hello!

What about quality parameter for sharp? What do you think about either to add a possibility to let pass anything to a sharp processor or, at least, add parameter attribute?

P.S. Is this still being maintained?

derhuerst commented 5 years ago

What about quality parameter for sharp? What do you think about either to add a possibility to let pass anything to a sharp processor or, at least, add parameter attribute?

Sounds good! PR welcome!

Is this still being maintained?

Yes this is being maintained. I just haven't bothered making a major version bump to use the latest sharp & p-event dependencies.

VitaliyR commented 5 years ago

@derhuerst I can try to do that if you want. Should I just add quality option for resolving this issue? Or you prefer to update the sharp dep? In case of update - should I remain API of this plugin to be the same? Because if you want to bump major version, I think, it is acceptable to change API a little

derhuerst commented 5 years ago

Should I just add quality option for resolving this issue?

Let's do that: an optional parameter.

AFAICT, with the sharp API, applying the quality value without specifying a format is not possible (which is reasonable because the same value implies different visual quality with e.g. JPEG & WebP), so I propose to ignore quality if format is not given.

Or you prefer to update the sharp dep?

We can add this change as a non-breaking change, so let's do it separate from the sharp upgrade.

Because if you want to bump major version, I think, it is acceptable to change API a little

What would you like to change?

VitaliyR commented 5 years ago

PR: #13 I've decided to let developers decide what to pass to sharp. toFormat is expecting options, and, under the hood is just passing them to an appropriate format method. For instance, the quality parameter is supported for webp and jpeg formatters, but for png, you need to pass other.

What would you like to change?

I saw that sharp in next minor version has removed a lot of deprecations, that's why I've asked about changing the API, but nevermind :)

derhuerst commented 5 years ago

Thanks! Published as gulp-scale-images@1.2.0.