Progress events
It'd be nice if this lib could emit progress events during conversion. That'd be helpful to e.g. show a progress bar on ZoomHub. (As well as e.g. for user feedback in a CLI.)
Adding this to the IM implementation should be easy, but VIPS is harder, as it abstracts the whole thing away and doesn't emit progress events either AFAIK.
One idea @gasi and I discussed was to watch the output level directories for generated tiles. Don't know how feasible that is though, e.g. across platforms, Node versions, performance, etc.
If that proves to be a non-starter, another approach is to just fudge it with a timer. E.g. every second, see how many tiles have been generated, and emit the event then.
This isn't high-priority; just capturing these ideas.
libvips supports progress feedback in a couple of ways. You can call vips_image_set_progress() on an image and you'll be sent gobject signals as that image is processed:
http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/libvips-VipsImage.html#vips-image-set-progress
So just before calling vips_dzsave() you ask for progress signalling on the image you pass in and attach signal handlers for preeval, eval and posteval.
You can also get progress signalling on the CLI. Set VIPS_PROGRESS or use the --vips-progress flag and the vips driver program will draw ASCII bar graphs of evaluation progress. It's a bit fragile, but you could parse that.
@jcupitt Awesome, good to know!
@jcupitt Thanks for dropping by and letting us know. I actually made a note to myself about a month ago when I looked into it and saved the following snippet as parsing test sample:
> vips dzsave hs-2007-16-a-full_tif.tif carina-nebula --vips-progress
vips temp-1: 29566 x 14321 pixels, 8 threads, 128 x 128 tiles, 256 lines in buffer
vips temp-1: 100% complete
…
> vips dzsave hs-2007-16-a-full_tif.tif carina-nebula --vips-progress
vips temp-1: 29566 x 14321 pixels, 8 threads, 128 x 128 tiles, 256 lines in buffer
vips temp-1: done in 71.4s
P.S. How did you find this issue? :eyes: :wink:
@jcupitt Psst, just noticed that the subsequent links to the signals from http://www.vips.ecs.soton.ac.uk/supported/current/doc/html/libvips/libvips-VipsImage.html#vips-image-set-progress seem to be broken, e.g.
- http://www.vips.ecs.soton.ac.uk/usr/share/gtk-doc/html/libvips/VipsImage.html#VipsImage-preeval
- http://www.vips.ecs.soton.ac.uk/usr/share/gtk-doc/html/libvips/VipsImage.html#VipsImage-eval
- …
Hehe, github linked this issue from something on ruby-vips, I think. I'm trying to fix that up at the moment.
Yes, I noticed the signal links were broken yesterday :-( stupid gtk-doc, another thing for the TODO.