Page 1 of 1

Creating a resulting image with 24 rotations of the source image (every 15°)

Posted: 2018-01-25T10:52:28-07:00
by FrereTuck
Hi,

I currently have an image I'd like to rotate (every 15°) to create a series of images I will use later on.
Image
It would be nice to have that series in a single image.
I made a simple bash script that creates the 24 images, but would like to know how to do it in a single image and a single command if possible.

Code: Select all

convert -rotate "15" c.png c15.png
I also found this script, but it creates a gif file, and I'd like to keep a png:

Code: Select all

#!/bin/sh
#
# Create a rotating figure using Distort SRT transformations
#
command='convert -delay 10 c.png -virtual-pixel white'

for i in `seq 15 15 360`; do
  command="$command \\( -clone 0 -distort SRT $i \\)"
done

command="$command -delete 0 -loop 0 animated_distort_rot.gif"

eval $command

chmod 644 animated_distort_rot.gif
Image
If you think it's possible, please let me know.

Thanks.

Re: Creating a resulting image with 24 rotations of the source image (every 15°)

Posted: 2018-01-25T11:15:38-07:00
by fmw42
PNG does not support multi-frame images. GIF supports multi-frame images and animations. I believe you can save to TIFF also to have multipage images, but not animations. The imagemagick MIFF format can also be used, but only Imagemagick can view that.

So try

Code: Select all

convert c.png c.tif
for ((i=15; i<360; i=i+15)); do
convert c.tif \( c.png -background none -distort SRT $i \) c.tif
done
Again, this will not animate, but does contain every rotation angle in one file.

Re: Creating a resulting image with 24 rotations of the source image (every 15°)

Posted: 2018-01-25T11:20:19-07:00
by fmw42
P.S. You can view the animation, using Imagemagick animate as follows:

Code: Select all

animate -delay 50 c.tif

Re: Creating a resulting image with 24 rotations of the source image (every 15°)

Posted: 2018-01-25T11:40:13-07:00
by FrereTuck
Thanks a lot, Fred.