ColorQuantize
ColorQuantize[image] gives an approximation to image by quantizing to distinct colors.
ColorQuantize[image,n] uses at most n distinct colors.
ColorQuantize[image,{col1,…,coln}] represents an image using only the n specified colors coli.
Please visit the official Wolfram Language Reference for more details and examples on core symbols.