ImageMagick的。将图像切割成子图块的正确方法是什么 [英] ImageMagick. What is the correct way to dice an image into sub-tiles

查看:93
本文介绍了ImageMagick的。将图像切割成子图块的正确方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将图像切成N×N子图块图像的正确方法是什么?

What is the correct way to an dice an image into N x N sub-tile images?

谢谢,

Doug

Thanks,
Doug

推荐答案

谢谢,

实际上我有点想法并想出了正确的答案imagemagick incantations。

Actually I futzed a bit and came up with the correct imagemagick incantations.

这是tcsh版本。

将图像切成4 x 4网格(结果图像)编号后续)。数字系统被解释为:col + row * nrows:

Dice an image into a 4 x 4 grid (resultant images numbered sequentual). The number system is interpreted as: col + row * nrows:

$ convert -crop 25%x25% image.png tile-prefix.png

通常需要将顺序编号重新映射到第x行。例如,如果您在iOS应用程序中使用CATiledLayer,则需要为给定的比例摄取正确的图块。方法如下:

Often it is desirable to remap the sequential numbering to row x column. For example if you are using CATiledLayer in an iOS app and will need to ingest the correct tiles for a given scale. Here's how:

while ( $i < $number_of_tiles )  
while -> set r = `expr $i \/ 4`  
while -> set c = `expr $i \% 4`  
while -> cp tile-prefix-$i.png tile-prefix-${r}x${c}.png  
while -> echo $i  
while -> @ i++  
while -> end

这篇关于ImageMagick的。将图像切割成子图块的正确方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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