Page 1 of 1

Different -delay behavior on different machines

Posted: 2012-01-02T17:36:48-07:00
by sradu
I'm creating an animated gif using rmagick:

Code: Select all

input = ImageList.new 
input.delay = 14.2
   
gif_files.each do |pic|
      image =  Image.read(pic).first
      
      input << image
 end

input = input.optimize_layers(Magick::OptimizeTransLayer)

out_filename = "/tmp/mm_#{rand(1000000)}.gif"
input.write(out_filename)
On my development machine (mac os x, im 6.7.1-1) it works perfectly and returns an animated gif with 7fps.
On my production machine (debian squeeze, xen, im 6.6.9-7) it returns an animated gif that's animating way too fast. I tried moving the delay line at the bottom, or using image.delay and nothing works.

What could be wrong?

Re: Different -delay behavior on different machines

Posted: 2012-01-02T18:16:35-07:00
by glennrp
sradu wrote:I'm creating an animated gif using rmagick:

Code: Select all

On my development machine (mac os x, im 6.7.1-1) it works perfectly and returns an animated gif with 7fps.
On my production machine (debian squeeze, xen, im 6.6.9-7) it returns an animated gif that's animating way too fast. I tried moving the delay line at the bottom, or using image.delay and nothing works.

What could be wrong?[/quote]
I think that problem is outside the scope of ImageMagick, and I believe it
depends on the viewing platform, not on the platform that creates the GIF.
I have a site with a bunch of GIF animations and finally resorted to putting up
two versions of every page, one with a fast animation and one with a slower
one, and let people pick the one they like best.  That approach would not work in
most scenarios but did work in my case where there were just a few
people, who came to the site every day, and they learned which worked
for them.

What happens when you create an aniGIF on one platform and
view it on the other, and [i]vice versa[/i]?  What application are you
using to view the GIF?

Re: Different -delay behavior on different machines

Posted: 2012-01-03T02:05:14-07:00
by sradu
glennrp wrote:What happens when you create an aniGIF on one platform and
view it on the other, and vice versa? What application are you
using to view the GIF?
On mac os x I am opening the aniGIF in 2 browsers (Chrome & Firefox) and via the system preview (pressing space on the gif in Finder). The behavior is consistent that the gifs created on the production xen machine have the crazy fast animation while the ones created in development work.

I haven't been able to do it the other way around, view animated gifs on the production machine.

Re: Different -delay behavior on different machines

Posted: 2012-01-03T08:55:20-07:00
by glennrp
sradu wrote:
glennrp wrote:What happens when you create an aniGIF on one platform and
view it on the other, and vice versa? What application are you
using to view the GIF?
On mac os x I am opening the aniGIF in 2 browsers (Chrome & Firefox) and via the system preview (pressing space on the gif in Finder). The behavior is consistent that the gifs created on the production xen machine have the crazy fast animation while the ones created in development work.

I haven't been able to do it the other way around, view animated gifs on the production machine.
Well, that does sound like a problem with ImageMagick, then. However, looking at the diff
between coders/gif.c in IM-6.6.9-7 and 6.7.1-2 (I don't have -1) doesn't reveal
any changes that might affect how the interframe delay is written.

I built 6.6.9-7 and 6.7.1-2 (don't have 6.7.1-1 source) on my Ubuntu platform and ran this
commandline which should be equivalent to your script:

Code: Select all

convert -delay 14.2 -size 100x100 xc:white xc:red xc:green xc:blue -layers optimize delay.gif
identify -verbose delay.gif | grep Delay
All versions 6.6.9-7, 6.7.1-2, and 6.7.4-4 produced the same 4 lines of output
  • Delay: 14x100
    Delay: 14x100
    Delay: 14x100
    Delay: 14x100
and the three resulting animated GIF files were identical.

What does "identify -verbose file.gif | grep Delay" show for your
good and bad files?

Re: Different -delay behavior on different machines

Posted: 2012-01-05T03:38:58-07:00
by sradu
Thanks for looking into this. There were two problems, both in my code. First the behavior of Dir.glob which would return sorted files on my dev machine but not in production, and a Rails plugin called delayed_job which was overwriting the .delay function.

I got it working now.