added support for animated gifs with different durations, improved
support for different animated gif formats