ImageMagick将大图像裁剪成xyz图块 [英] ImageMagick cropping large image into xyz tiles

查看:206
本文介绍了ImageMagick将大图像裁剪成xyz图块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个大的jpg,其分辨率为x * 256 / x * 256.我想将此图像切割成256x256的图块,其命名约定为{zoom} - {x} - {y} .jpg 。在过去,我使用ZoomifyExpress Converter进行切割和缩放。我还想要6种不同的缩放级别。到目前为止我用这个命令开始了:

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

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

这会产生很多xy.jpg图块。我不知道如何添加不同的缩放级别。我对ImageMagick来说相对较新,这感觉就像是一件基本的事情。希望有人可以帮助我。在此先感谢。

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.

推荐答案

我找到了解决方案:

I只需将图像调整到适当的大小,然后裁剪它。文件名中的第一个数字是缩放级别。

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 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

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.

这篇关于ImageMagick将大图像裁剪成xyz图块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆