The optimization algorithm is only applicable to the image of mode="P" or "L".
Merge pull request #993 from moriyoshi/fix/moriyoshi/gif-encoder-optimization-bug

The optimization algorithm is only applicable to the image of mode="P" or "L".