The quality of the resulting image depends on the approximation method you use, the range of colors in the input image, and whether or not you use dithering. Note that different methods work better for different images. See Dithering for a description of dithering and how to enable or disable it.
Quantization Reducing the number of colors in an image involves quantization.
The function rgb2ind uses quantization as part of its color reduction algorithm. An important term in discussions of image quantization is RGB color cube , which is used frequently throughout this section. The RGB color cube is a three-dimensional array of all of the colors that are defined for a particular data type. This color cube is the same for all uint8 RGB images, regardless of which colors they actually use. In other words, the brightest red in an uint8 RGB image displays the same as the brightest red in a double RGB image.