Refactor the GifWriter.write{,_animated}_image() methods