../STX
source

ImageMagick Snippets

2024-03-01

NB: The convert command is deprecated in IMv7, use “magick” instead of “convert” or “magick convert”

inspo sites:

1. Rotate a tiled image 45 degrees #

Better results with square images, of course. The 45 is the degree amount.

magick in.png -matte -virtual-pixel tile +distort ScaleRotateTranslate '1  1  45' out.png

2. Stack images vertically #

magick 1.jpg 2.jpg 3.jpg -gravity center -append out.jpg

3. Create a solid color image #

magick -size 100x100 "xc:#cccccc" out.png

4. Rotate a tiled image an arbitrary degree #

see also: tiletilt

tile="some_file.png"
angle=$((RANDOM % 360))
w=1920
h=1080

magick "$tile" -set option:distort:viewport "${w}x${h}" \
    -virtual-pixel tile -filter point \
    -distort SRT "$angle" \
    -gravity center -crop "${w}x${h}+0+0" +repage \
    "result.png"