在imagemagick中将图像平铺x次到y px输出图像

时间:2014-10-28 17:29:50

标签: imagemagick dragonfly-gem

我正在使用ImageMagick(通过Ruby中的Dragonfly)并需要转换如下图像:

X

像这样平铺:

XXX XXX XXX

并设置宽度(在我的情况下为200像素)。

我将如何做到这一点?

1 个答案:

答案 0 :(得分:1)

使用ImageMagick,您将使用tile:格式加载源图像。

convert -size 200x200 tile:x.png out.png

对于Dragonfly,您需要扩展Dragonfly.app.generate

image = Dragonfly.app.generate(:convert, '-size 200x200 tile:x.png', 'png')