Fix a bug in _rgb2hex.

Small values would be converted to single-digit hexadecimal values
because of an incorrect length calculation.
Merge pull request #71 from fdb/rgb2hex

Fix a bug in _rgb2hex.