make image quantization routine
(#558)