Introduce `whenJpeg` (and similar for PNG etc) as alternative to `force: false`
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 32.7k
- Forks
- 1.4k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 5
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked issue #659 and comparing the proposed whenJpeg syntax with the existing jpeg({quality: 75, force: false}) behavior. Trace how the JavaScript pipeline exposes format-specific methods, then determine the scope for equivalent PNG and other format methods. Done means the naming and compatibility direction is settled and the documented behavior matches the existing option.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100