When importing GIF animations with variable frame durations, the settings for "DisplayDurations" are not recovered correctly. As an example, I'm using the movie from this earlier question:
Here I'm repeating the code to generate it, putting the gradually increasing frame durations in a variable durations
:
frames =
Table[Graphics[
Text[Style["Slow Down", FontFamily -> "Futura", FontColor -> Blue,
FontSize -> 48], {0, y}], Background -> Cyan,
PlotRange -> {{-1, 1}, {.1, 1.5}}], {y, 1.2, .2, -.1}];
durations = Append[Range[Length[frames] - 1]/20, 2];
Export["slowDownMovie.gif", frames, "DisplayDurations" -> durations,
"AnimationRepetitions" -> Infinity];
durations//N
{0.05, 0.1, 0.15, 0.2, 0.25, 0.3, 0.35, 0.4, 0.45, 0.5, 2.}
Now compare to the durations that we get when re-importing the same animated GIF:
newDurations = Import["slowDownMovie.gif", "DisplayDurations"]
{20., 20., 20., 20., 20., 20., 20., 20., 20., 20., 20.}
newDurations == durations
False
As expected from this negative result, ListAnimate
also plays the animation at an incorrect, constant frame delay. It seems clear that this is a bug.
Before I start looking for a platform-specific hack to fix this: is there any way to get the correct display durations from a GIF with the Import
function? I looked into the "Frames"
element of the GIF import, but that also seems to have the wrong display duration in it.
I haven't looked at the raw data, but if one has to do that it may be better to find a non-Mathematica hack instead.
Edit
Wolfram support has confirmed it's a bug [TS 19773].