ImageMagick crop large image into xyz tiles

I have a large jpg that has a resolution of x * 256 / x * 256. I want to cut this image into 256x256 tiles using the naming convention {zoom} - {x} - {y} .jpg, In the past I used ZoomifyExpress Converter, which does cutting and scaling. I also want 6 different zoom levels. I started with this command:

convert example.jpg -crop 256x256 + gravity -set filename: tile. / tiles /% [fx: page.x / 256] -% [fx: page.y / 256]% [filename: tile] .jpg

This creates a lot of xy.jpg tiles. I do not know how I can add different levels of increase. I'm a relative newbie to ImageMagick and this seems like a basic thing. Hope someone can help me. Thanks in advance.

+4
source share
2 answers

I found a solution:

I just resize the image to the appropriate size and then crop it. The first number in the file name is the zoom level.

convert example.jpg -resize 256x256 -crop 256x256 -set filename: tile. / tiles / 0 -% [fx: page.x / 256] -% [fx: page.y / 256]% [filename: tile] .jpg

convert example.jpg -resize 512x512 -crop 256x256 -set filename: tile. / tiles / 1 -% [fx: page.x / (256)] -% [fx: page.y / (256)]% [filename: tile] .jpg

.. and so on, until I reached the highest resolution.

+4
source

The following tutorial shows how to use ImageMagick to create xyz tiles:

+2
source

All Articles