Stabilise gifs using javascript canvas