fix color quantization code to work with low memory (the code to quantize with 888 RGB eats more than 64MB RAM)