http://www.rollthepotato.net/~john/deepzoom/
All you need to do is convert your image to deepzoom format and paste a few lines of code into your page. Since 7.30.1, libvips has included a fast DeepZoom saver. Use it like this:
$ vips dzsave theo.jpg dz --overlap 12 --tile-size 94This will create a directory called "dz_files" containing all the image tiles, and a file called "dz.dvi" containing the image metadata. Tile size and overlap are 256 and 1 by default. You can also set the image format for the tiles.
It runs quickly and doesn't need much memory. It streams the source image through the Deep Zoom writer, keeping just enough in memory to be able to write two lines of tiles. Memory use therefore scales with image width, not image size. It also uses a set of threads to write tiles in parallel, so it ought to get faster on many-core machines.
On my elderly desktop I see:
$ vips dzsave theo.jpg dz --vips-leakFor comparison, OpenZoom have a DeepZoom writer done in PIL:
memory: high-water mark 20.77 MB
real 0m1.480s
user 0m1.632s
sys 0m0.312s
$ time ./deepzoom.py theo.jpgSo vips is about 17 times faster and needs one seventh of the memory.
memory: peak RSS 150 MB
real 0m25.983s
user 0m25.014s
sys 0m0.368s
The differences are larger for larger images. On a 10,000 x 10,000 pixel image I see:
$ time vips dzsave wtc.jpg x --vips-leak
memory: high-water mark 32.36 MB
real 0m5.450s
user 0m6.364s
sys 0m0.952s
$ time ./deepzoom.py wtc.jpgNow vips is about 20 times faster and needs one twentieth of the memory.
memory: peak RSS 600 MB
real 1m43.012s
user 1m41.598s
sys 0m0.828s
I added some notes about arguments and how memory use and performance should scale.
ReplyDeletegit master libvips now supports Zoomify and Google maps formats as well. I made this Zoomify pyramid in 15 minutes on my laptop:
ReplyDeletehttp://www.rollthepotato.net/~john/zoomify/1-Defaults.htm
That's processing from a jpeg2000 source, it'd be quicker from regular jpeg, or tiff.
does it possible to specify some flag to overwrite or ( better ), make missed parts from it
ReplyDeleteYou can only remake the whole pyramid.
ReplyDeleteI made a fastcgi tile server here that makes tiles on the fly directly from the original image:
https://github.com/jcupitt/tilesrv
but of course that's not suitable for high-traffic sites.
Hi John,
ReplyDeleteWhat are the hardware specifications (CPU, RAM, etc.) for the "elderly desktop" that you used to run these benchmarks?
Thanks.
It was an HP workstation from 2006: 2 Opteron 254 processors at 2.7 GHz and 4GB of RAM.
DeleteOn my basic i5-3210m laptop, for a 10,000 x 10,000 pixel RGB JPEG I see:
$ time vips dzsave wtc.jpg x
real 0m2.320s
user 0m5.259s
sys 0m1.037s
So about twice as fast. There's a more recent blog post on the pyramid builder here:
http://libvips.blogspot.co.uk/2013/03/making-deepzoom-zoomify-and-google-maps.html
Thanks, John, for the very useful information!
Delete