Provide pre-pipeline function to modify options based on input image metadata
See original GitHub issueThis could seriously increase the power of Stream-based image processing.
Here’s an example of how halving an image’s dimensions could work:
// 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.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:36
- Comments:15 (3 by maintainers)
Top Results From Across the Web
Modifying Image Metadata Without Recompressing Image
QA1895: Image I/O provides an API that allows for modifying image metadata without having to resave or recompress the image.
Read more >Read and Edit Image Metadata with Python | by Kenneth Leung
We instantiate an exif Image Class by reading the image in a binary format before checking whether it contains any metadata. If so,...
Read more >Metadata basics and actions in Lightroom Classic
Learn about Adobe Photoshop Lightroom Classic metadata (information about a photo, such as author name, resolution, color space, copyright, ...
Read more >Input metadata - High performance Node.js image processing
A Promise is returned when callback is not provided. format : Name of decoder used to decompress image data e.g. jpeg , png...
Read more >exiftool Application Documentation
So ExifTool alone may not be used to securely edit metadata in PDF files. ... the Image::ExifTool Options documentation), and provides a method...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Any news for this feature ?
It will be nice to have this feature but I’m using
image-size-stream
as an alternative for now.Example:
Using a paused
PassThrough
stream as buffer whileImageDimensionsStream
returns the image dimensions works out nicely.