使用 ImageMagick 重复或“平铺”一个图像
如何使用 ImageMagick 平铺图像?我认为我不能使用 montage
因为我希望列移位原始图像高度的 50%。
展示我想要做的事情的示例可能更容易:
开头:
结尾:
谢谢!
How do I tile an image using ImageMagick? I don't think I can use montage
because I want the columns displaced by 50% of the original image height.
It's probably easier to show an example of what I'm trying to do:
Start with:
End with:
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您想要普通瓷砖,而不需要向下移动第二列和其余偶数列,您可以使用以下脚本:(
可能大多数登陆这个问题的人都想要这样的普通瓷砖,就像我一样)
我的“Ball. “jpg”的大小为 200 x 200 像素,因此此脚本创建一个 4x3 平铺图像。
对于 ImageMagick 7 用户,请将 Convert 替换为 magick。
In case you want plain tiles, without shifting down the second column and the rest of the even columns, you can use this script:
(probably the majority of people landing on this question want such plain tiles, like I did)
My "Ball.jpg" is 200 x 200 pixels, so this script creates a 4x3 tile image.
For ImageMagick 7 users, replace convert with magick.
感谢 Fred 的 ImageMagick 脚本 上的 Fred,这是解决方案:
这正是我正在寻找的为了。
Thanks to Fred at Fred's ImageMagick Scripts, here's the solution:
This is exactly what I was looking for.
即使您没有提及任何有关使用上下文的内容,我也会将其放在这里以便更多人知道。 Fred 的脚本仅供非商业使用。我以替代解决方案结束,但是原理是相同的:
创建移动图块:
转换_orange_270.jpg -roll +0+135 _orange_270_r.jpg
创建一列常规图块:
蒙太奇_orange_270.jpg +克隆 +克隆 +克隆 -tile x4 -geometry +0+0 _1col.jpg
创建一列移位图块:
蒙太奇_orange_270_r.jpg +克隆 +克隆 +克隆 -tile x4 -geometry +0+0 _2col.jpg
组合常规列和移位列:
蒙太奇-几何+0+0 _1col.jpg _2col.jpg _2cols.jpg
使用第 4 点的最后输出创建完整平铺图像:
转换_2cols.jpg -写入mpr:tile +删除-大小1920x1080tile:mpr:tile _wallpap.jpg
结果:
Even though you did not mention anything about context of usage, I will put it here so more people are aware. Fred's scripts are for non-commercial use. I ended with an alternative solution, however, principle is the same:
Creating shifted tile by:
convert _orange_270.jpg -roll +0+135 _orange_270_r.jpg
Create a column of regular tiles:
montage _orange_270.jpg +clone +clone +clone -tile x4 -geometry +0+0 _1col.jpg
Create a column of shifted tiles:
montage _orange_270_r.jpg +clone +clone +clone -tile x4 -geometry +0+0 _2col.jpg
Combined regular and shifted columns:
montage -geometry +0+0 _1col.jpg _2col.jpg _2cols.jpg
Created full tiled image using last output from point 4:
convert _2cols.jpg -write mpr:tile +delete -size 1920x1080 tile:mpr:tile _wallpap.jpg
Result:
如果在带有 ImageMagick 的类 UNIX 系统上,您可以使用我的脚本,tileimage,位于 http ://www.fmwconcepts.com/imagemagick/tileimage/index.php。
它提供了多种翻转、旋转和偏移的变化。
如果非商业用途,那么它是免费的,如果商业用途,那么联系我获取许可证。
有关 ImageMagick 中平铺的信息,请访问 http://www.imagemagick.org/Usage/canvas /#图块
If on a unix-like system with ImageMagick, you could just use my script, tileimage at http://www.fmwconcepts.com/imagemagick/tileimage/index.php.
It provides numerous variations on the flipping, rotation and offsets.
If non-commercial use, then it is free, If commercial use, then contact me for a license.
Information about tiling in ImageMagick can found at http://www.imagemagick.org/Usage/canvas/#tile