sharp icon indicating copy to clipboard operation
sharp copied to clipboard

Introduce `whenJpeg` (and similar for PNG etc) as alternative to `force: false`

Open henrik opened this issue 6 years ago • 0 comments

As discussed here: https://github.com/lovell/sharp/issues/659

This naming could make it clearer that it only applies to JPGs.

The proposed syntax would be:

pipeline.resize(100,100).whenJpeg({quality : 75}).toBuffer(function(){})

Which would do the same as:

pipeline.resize(100,100).jpeg({quality : 75, force : false}).toBuffer(function(){})

Alternative function names could be ifJpeg or jpegOptions.

I don't know this lib well enough to know whether force: false should be deprecated/removed or not.

henrik avatar Jan 17 '20 11:01 henrik