potential bug in -loop 0 for gif animation in IM 6.4.3-6

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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

potential bug in -loop 0 for gif animation in IM 6.4.3-6

Post by fmw42 »

IM 6.4.3-6 Q16 Mac OSX Tiger

I am finding that -loop 0 on animation with frames that are gif files does not seem to work; whereas if the input frames are not gif, then it does seem to work.

For example this works to loop continuously:
convert -delay 50 rose: \( rose: -negate \) -loop 0 rose_anim.gif

rose_anim.gif
Image

Looking at identify -verbose rose_anim.gif, I find a section that says:
Delay: 50x100
Iterations: 0
Scene: 0 of 2



But this does not loop continuously, but only one iteration:
convert -delay 50 morphA.gif morphB.gif -loop 0 morph_anim.gif

morphA.gif:
Image

morphB.gif:
Image

morph_anim.gif:
Image

Looking at identify -verbose morph_anim.gif, I find a section that says:
Delay: 50x100
Scene: 0 of 2

Note that the line:
Iterations: 0
Is Missing


Am I doing something wrong or is there something odd about the two morph images? This used to work properly.
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: potential bug in -loop 0 for gif animation in IM 6.4.3-6

Post by magick »

We will have a patch for the problem you reported by sometime tomorrow. In the mean-time use:
  • convert -delay 50 -loop 0 morphA.gif morphB.gif morph_anim.gif
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: potential bug in -loop 0 for gif animation in IM 6.4.3-6

Post by fmw42 »

magick wrote:We will have a patch for the problem you reported by sometime tomorrow. In the mean-time use:
  • convert -delay 50 -loop 0 morphA.gif morphB.gif morph_anim.gif
Just curious, but is this the preferred syntax with -loop 0 at the beginning. I have just been following Anthony's examples where he seemed to always have -loop 0 at the end just before the output image.

How does having it before the input image list differ from having it after the input image list, if there is suppose to be a difference?

If having it prior to the input image list is preferred, I will change my scripts to follow that convention.

Thanks.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: potential bug in -loop 0 for gif animation in IM 6.4.3-6

Post by anthony »

-loop 0 was ment to be an output setting, and should be at the end where it is most logical.

However what is happening is that it is image meta data which gets stored in images. This is why -delay is given before reading in images and -set delay is done after, more control

Due to historical handling however some image meta-data settings like -loop -background etc. override the meta data in the images themselves, from a globally saved 'current' setting, the image meta-data is only used if the global is 'undefined'.

We are having the same problem with -compose at the moment as in tiff and other 'layered' image formats -compose is a image meta-data setting, where IM usage it is a operator setting, like -background. It is currently broken in this regard and NEEDs FIXING jsut as -loop does.

The whole matter was quite clear and working nicely until recently when we tried to get some settings working accross parenthesis, but instead cause 'typical' usage to fail.

As such at this point what each setting 'option' should do
is currently as clear as mud.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: potential bug in -loop 0 for gif animation in IM 6.4.3-6

Post by magick »

We're working on the problem. The latest patches will be available in about an hour.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: potential bug in -loop 0 for gif animation in IM 6.4.3-6

Post by fmw42 »

magick wrote:We're working on the problem. The latest patches will be available in about an hour.
Magick, it is not urgent on my part. Just wanted to let you know about it. I appreciate the alternate usage in the meantime and can use that until it is properly fixed.

Anthony, I appreciate the feedback explanation.

Thanks
leggzz66

Re: potential bug in -loop 0 for gif animation in IM 6.4.3-6

Post by leggzz66 »

I see it still isnt working, when will it be fixed, cause i dont get what u said to do or where to put that more accuratly.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: potential bug in -loop 0 for gif animation in IM 6.4.3-6

Post by fmw42 »

leggzz66 wrote:I see it still isnt working, when will it be fixed, cause i dont get what u said to do or where to put that more accuratly.

I believe that the next release is still being worked on as there are a number of related issues.

You just need to move -loop 0 from after the images to just before the images. So rather than

convert -delay 50 morphA.gif morphB.gif -loop 0 morph_anim.gif

use

convert -delay 50 -loop 0 morphA.gif morphB.gif morph_anim.gif

I have not tested this, but this is what was described above in posts from Magick and Anthony
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: potential bug in -loop 0 for gif animation in IM 6.4.3-6

Post by anthony »

When the next point release is released (after the bugs has been worked out), the -loop 0 can be placed anywhere again.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
NR_sdy

Re: potential bug in -loop 0 for gif animation in IM 6.4.3-6

Post by NR_sdy »

Rather than post a new thread on the same topic...

Currently using 6.4.9-7, finding similar behavior.

I have two animations, one built using a PNG background and a series of PNGs with a transparent color on top, using -dispose previous to retain the background, and the other using composited PNGs where the top layer is blended over the background and -dispose left as default.

With the first animation, '-loop 0' appears to work, whether I explicitly define it or leave it out:

'convert [-loop 0] -delay <background>.png -delay 1 -dispose previous <otherfiles*>.png <output.gif>'

Every input layer contains the attribute 'Iterations: 0'. The output contains the attribute only on the first layer. All layers contain the correct delay and dispose attributes, and the animation loops properly. That's the expected result, but I need the background to show through the other frames, so I use 'composite -dissolve 50 <file.png> <background.png> <output.png>'...great tool btw, quick and handy! Does exactly what I need.

Problem is, the result no longer loops. The individual output frames from composite no longer contain the 'Iterations: 0' attribute (not that they technically need to, being single frames). When I convert them to an animated gif using 'convert <files*.png> <output.gif>', even though the first frame has the 'Iterations: 0' attribute, the animation doesn't loop. I can replace the 'Iterations' tag using 'convert -loop 0 <file.png> <file.png>', but not <file.png> <file.gif>.

I have tried converting the output composited PNGs to individual GIFs, then combining as an animation, with the same results...the output animation contains 'Iterations: 0' on the first frame, but does not loop.

I'm confused...anyone have any ideas why the composite step would stall the final animation? I can probably post the two animations (working and not), the behavior is the same whether it's a few frames or the full run. Alternatively, I could post the 'identify -verbose' results for the two. I've looked them over, but not certain what I should be looking for, as far as why one works but not the other.

Also, and this is a nitpicky comment, the first frame is listed as 0 of n, the last frame is listed as n-1 of n...not sure if that was intentional ;).

Thanks for any help!
NR_sdy

Re: potential bug in -loop 0 for gif animation in IM 6.4.3-6

Post by NR_sdy »

Nevermind. Likely it's a problem in the displaying software I was using. Firefox and Powerpoint both loop the GIF correctly now.
stinkinrich88

Re: potential bug in -loop 0 for gif animation in IM 6.4.3-6

Post by stinkinrich88 »

Hello, this still doesn't work for me.

I'm using Ubuntu Karmic (with ImageMagick 6.5.1-0 2009-08-27 Q16 from the repos)

I tried to upgrade to the latest version but there are no deb files and make install failed.

Any ideas?
Post Reply