Page 1 of 1
Series of images by rotating
Posted: 2010-07-13T16:44:57-07:00
by sfg
I want to apply this code, more or less:
Code: Select all
convert test.png -matte -virtual-pixel transparent \ -distort ScaleRotateTranslate 1 *.png
to generate a series of images, each rotated 1 degree more than the previous one. So, I start with test.png which will be at 0 degrees, test1.png will be at 1 degree and so on until a 360 degrees rotation is done.
Like it is, it will do one image and that's all. I don't know how to make it run over the newly created images or apply a bigger rotation to the original image and create a new file everytime... and I assume both are possible?
Re: Series of images by rotating
Posted: 2010-07-13T16:54:40-07:00
by anthony
sfg wrote:I want to apply this code, more or less:
Code: Select all
convert test.png -matte -virtual-pixel transparent \ -distort ScaleRotateTranslate 1 *.png
to generate a series of images, each rotated 1 degree more than the previous one. So, I start with test.png which will be at 0 degrees, test1.png will be at 1 degree and so on until a 360 degrees rotation is done.
Like it is, it will do one image and that's all. I don't know how to make it run over the newly created images or apply a bigger rotation to the original image and create a new file everytime... and I assume both are possible?
First -- you can not output to a 'wildcard' filename! That just does not make any sense
As for the series.. try this...
Code: Select all
for i in {000..359}
do
convert test.png -alpha on -virtual-pixel transparent \
-distort ScaleRotateTranslate $i \
rotated_$i.png
done
Re: Series of images by rotating
Posted: 2010-07-13T16:56:14-07:00
by fmw42
you need to write a script loop changing the rotation and resulting filename each iteration
Re: Series of images by rotating
Posted: 2010-07-13T17:02:35-07:00
by sfg
anthony wrote:
First -- you can not output to a 'wildcard' filename! That just does not make any sense
Yeah, I know... I wanted to show that there should be different files.
As for the series.. try this...
Code: Select all
for i in {000..359}
do
convert test.png -alpha on -virtual-pixel transparent \
-distort ScaleRotateTranslate $i \
rotated_$i.png
done
I tried, but I get a "sintax error" for each line... except the convert one where it says it can't find the file.
Am I doing something wrong?
This is the image:
Re: Series of images by rotating
Posted: 2010-07-13T17:11:17-07:00
by fmw42
might it not be able to tell 000 from 0? that is 000 causes an error? or like in my old Mac OSX Tiger, that "for" sequence does not work and you have to use another looping method.
Re: Series of images by rotating
Posted: 2010-07-13T17:13:53-07:00
by sfg
I'm using Windows, in case it matters... and I launched that from a bat file.
I tried replacing 000 with 0, but still the same.
Re: Series of images by rotating
Posted: 2010-07-13T17:20:51-07:00
by fmw42
In windows, the \ is replaced with ^
see
http://www.imagemagick.org/Usage/windows/
but perhaps you have corrected for that.
Is your IM version current enough for -distort SRT?
Re: Series of images by rotating
Posted: 2010-07-13T17:31:39-07:00
by snibgo
Translated to Windows:
Code: Select all
for /L %%i in (0,1,359) DO (
convert test.png -alpha on -virtual-pixel transparent ^
-distort ScaleRotateTranslate %%i ^
rotated_%%i.png
)
Re: Series of images by rotating
Posted: 2010-07-13T17:46:37-07:00
by sfg
Still getting Syntax Error after
I also tried putting everything in one line, but I get the same error...
Re: Series of images by rotating
Posted: 2010-07-13T17:52:38-07:00
by sfg
Ah, it seems to work like this
Code: Select all
FOR /L %%i IN (0,1,359) DO convert test.png -alpha on -virtual-pixel transparent -distort ScaleRotateTranslate %%i rotated_%%i.png
Thanks for the help!
Re: Series of images by rotating
Posted: 2010-07-13T17:54:43-07:00
by snibgo
I am on Windows 7, IM version 6.6.3-0. You should paste my example into a batch file, then run it.
What version of Windows and IM are you on? (Type: convert -version)
What EXACT output do you get from the command file?