Fix dynamic resizing of GIF images (bug #1219336)