ImageMagick cropping large image into xyz tiles

别说谁变了你拦得住时间么 提交于 2019-12-13 13:28:13

问题


i'm having a large jpg, which has a resolution of x * 256 / x * 256. I want to cut this image into 256x256 tiles with a naming convention {zoom}-{x}-{y}.jpg. In the past i've used ZoomifyExpress Converter which does the cutting and zooming. I also want 6 different zoom levels. I've started so far 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 produces a lot of x-y.jpg tiles.I don't know how i can add different zoomlevels. I'm relativly new to ImageMagick and this feels like a basic thing to do. Hopefully somebody can help me out. Thanks in advance.


回答1:


I found the solution:

I just resize the image to the appropriate size and then crop it. The first number in the filename 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 reach the highest resolution.



来源:https://stackoverflow.com/questions/26271757/imagemagick-cropping-large-image-into-xyz-tiles

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!