Provide pre-pipeline function to modify options based on input image metadata
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 32.7k
- Forks
- 1.4k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 5
Description
This could seriously increase the power of Stream-based image processing.
Here's an example of how halving an image's dimensions could work:
``` javascript
// PROPOSED API NOT YET AVAILABLE
var halver = sharp().before(function(metadata) {
this.resize(metadata.width / 2, metadata.height / 2);
});
readableStream.pipe(halver).pipe(writableStream);
// PROPOSED API NOT YET AVAILABLE
```
The existing `metadata` logic can also be improved to require only the first few hundred bytes of a Stream.
In addition, adding a "playbook" of example uses for this feature to the docs would be great too. There's a variable/percentage extract/crop under discussion at #205 that this should allow for.
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 existing metadata logic and the stream-processing entry point. Trace how image metadata becomes available, then define how the proposed before callback would modify options and how metadata could require only the first few hundred stream bytes; done includes the API behavior and documented example uses.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- backend, computer-vision
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100