Made animated image detection more robust (Fixes #56)