Error with animators with over 10 frames

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
flintstone

Error with animators with over 10 frames

Post by flintstone »

With less than 10 frames, animated gifs come out fine (with convert.exe)
after 10 frames, it shows frame 1, then 10, then continues as normal. at the end, it pauses before looping.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Error with animators with over 10 frames

Post by anthony »

Can you give use a more detailed example?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
flintstone

Re: Error with animators with over 10 frames

Post by flintstone »

Image
This animation has 11 frames, titled frame[0-10].gif. Each one has one more letter than the last.
It was made with the command convert.exe -delay 30 -loop 0 frames/frame*.gif result.gif, which worked for animations with 9 or less frames.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Error with animators with over 10 frames

Post by anthony »

flintstone wrote:

Code: Select all

convert.exe -delay 30 -loop 0 frames/frame*.gif result.gif
Well that your problem!!!! You assume IM recieved your images in numerical order! It didn.t The order is NOT what IM recieved and thus not IM's fault!

The rest of the animation does not appear as it is using a transparent background without using a -dispose background or -dispose previous to clear the old frames completely. So the frames just overwrite what the second frame has already drawn, making no more changes. See IM examples, Animation Basics for details of disposal methods!

try this...

Code: Select all

echo frames/frame*.gif
You will find you got frame1.gif then frame10.gif then frame2.gif
WHY? because it is sorts alphabetically, NOT numerically

Use this instead.

Code: Select all

   convert.exe -delay 30 -loop 0 frames/frame?.gif frames/frame??.gif result.gif
that will list single digit frames first, then double digit frames!!!
OR if you have a more advanced shell (like bash) use...

Code: Select all

   convert.exe -delay 30 -loop 0 frames/frame{?,??,???}.gif  result.gif
better still save all your frames using the same number of digits, so they are in order alphabetically
01 02 03 ... 09 10 11
See IM Examples, Writing a Multi-Image Sequence for other alternatives for reading files numerically.


There are also tools and utilities that you can use to do this, for you.

I have one called mv_renum that renames files so it expands numbers to enough digits to match the largest number given.
I have another script (same one actually just with a different name) called mv_reseq that will resequence the numbers to start at the number given (1 by default) and increment the files by a second number given (1) I use this to expand filenames so I can insert extra files inbetween, then contract the numbers back down to incrementing numbers again. Very useful for sorting image sequences.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
flintstone

Re: Error with animators with over 10 frames

Post by flintstone »

Thanks!
Post Reply