Command-Line Arguments Too Long

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Command-Line Arguments Too Long

Post by fmw42 »

use script with a while loop or something like that to build up your animation

something like:

convert image_0.png tmp.gif
i=1
while [ $i -lt 100 ]; do
convert tmp.gif -delay 1000 image_$i.png tmp.gif
i=`expr $i + 1`
done
convert tmp.gif -loop 0 image_animation.gif


This may not be the best solution, but seems to work for me.

I am not sure how you handle the leading zeros. But you can try with %03d. see viewtopic.php?f=1&t=13524&hilit=image+numbers
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Command-Line Arguments Too Long

Post by anthony »

fmw42 wrote:use script with a while loop or something like that to build up your animation
You can also convert that loop into a pipeline using the MIFF file format in the pipe.
By doing this you can avoid the need for the intermediate save files.

Code: Select all

i=0
while [ $i -lt 100 ]; do
  echo >&2 "processing image $i"
  convert tmp.gif -delay 1000 image_$i.png miff:-
  i=`expr $i + 1`
done | convert miff:- -loop 0 image_animation.gif
the other advantage is that you can do the caclulations while processing each image, allowing for better process reporting.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply