Improve the performance of GifWriter._get_pixels()