sharp
sharp copied to clipboard
Get operation progress information with handler function
First of all, thanks for the great job done with sharp !!! It is a very powerful tool for images manipulation...
I would like to get some information about progression (percentage or weight) of current image operation (eg: crop, resize, tiles...)
I didn't found anything about this need in all existing issues...
I imagine a handler function injection like :
var transformer = sharp()
.resize(300)
.on('progress', function(progress) {
console.log('Processing: ' + progress.percent + '% done');
});
I know libvips consider an environment variable named VIPS_PROGRESS
, so I guess there is something to do ?
By setting the VIPS_PROGRESS
environment variable, which outputs percentage progress to stdout
, you'll be able to assess how accurate this might be for a given operation.
Happy to accept a PR if you're able. This will require the use of AsyncProgressWorker and a minimum of N-API version 5, so would have to wait until we drop support for Node.js 10.