added a quantizecolors function

function to quantize an image to a certain number of colors