szczemp
szczemp

Reputation: 21

libvips - generate tiles starting from specific zoom level and specific coordinates

I am using windows cli version libvips. I want to generate map tiles for leaflet from image 8000px x 6000px. This image is old map of my town, and I want to display it on my website, but I am stuck on generating tiles. How to tell libvips to generate tiles from zoom level 10 to 15. With command

dzsave input.jpg outputdir --layout google

I receive tiles from zoom level 0 to 5.

And second question. How to set bounds of my map? Generated tiles from above command cover the whole world.

Upvotes: 2

Views: 568

Answers (1)

jcupitt
jcupitt

Reputation: 11220

The libvips CLI lets you run any save operation (like jpegsave, tiffsave or dzsave) as part of the write step of a command. You select the saver with the filename suffix and you can pass any parameters in square brackets at the end of the filename (be careful not to use any spaces).

So these two commands do the same thing:

vips jpegsave x.jpg y.jpg --Q 90
vips copy x.jpg x.jpg[Q=90]

The copy command will run jpegsave for you (it sees the .jpg suffix) and set Q to 90.

You can select dzsave with the .dz suffix. If your image is 50,000 x 50,000 pixels, you can save just the centre 50% with:

vips crop my-huge-map.jpg x.dz[layout=google] 12500 12500 25000 25000

I'm not sure what you mean by "layers 10 to 15". Do you only want the low-res layers? Just do a shrink by eg. 16 before running dzsave.

Upvotes: 0

Related Questions