Hi,
I have a 2D image with continuous colours and I want to convert it into an image with n discrete colours. If possible can you give two examples one with a user-defined “n” discrete colours, and the other one using the dominant colours of the original image ( I mean to present a picture only interms of its dominant colours)?
ColorQuantize should do what you’re suggesting. Here is an example that you can try:
im = LinearGradientImage[{Red, Blue}];
ColorQuantize[im, 4]
where I have specified that 4 colors should be displayed. See the doc page for ColorQuantize for more information.