Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using ImageMagick to repeat or "tile" an image

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:

enter image description here

End with:

enter image description here

Thanks!

like image 407
Mike Avatar asked Nov 18 '11 12:11

Mike


2 Answers

In case you want plain tiles, without shifting down the second column and the rest of the even columns, you can use this script:

convert -size 800x600 tile:Ball.jpg Tiles.jpg

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

like image 185
BearCode Avatar answered Oct 19 '22 23:10

BearCode


Thanks to Fred at Fred's ImageMagick Scripts, here's the solution:

infile="tile.png"

h2=`convert $infile -format "%[fx:round(h/2)]" info:`

convert $infile \( -clone 0 -roll +0+$h2 \) +append -write mpr:sometile +delete -size 1000x500 tile:mpr:sometile output.png

This is exactly what I was looking for.

like image 36
Mike Avatar answered Oct 20 '22 01:10

Mike