Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get operation progress information with handler function #2189

Open
tchambard opened this issue Apr 30, 2020 · 1 comment
Open

Get operation progress information with handler function #2189

tchambard opened this issue Apr 30, 2020 · 1 comment

Comments

@tchambard
Copy link

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 ?

@lovell
Copy link
Owner

lovell commented Apr 30, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants