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!
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!
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.
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.
tile:
cannot come before -size
? –
Wendt tile
pseudo-image format is specified as prefix in the filename. And according to convert manpage, input filename should be placed before input options: convert [input-option] input-file [output-option] output-file
–
Sandbox -geometry
option –
Funk 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.
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:
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
© 2022 - 2024 — McMap. All rights reserved.
convert -size 800x600 tile:Ball.jpg Tiles.jpg
– Sandbox