This class can be used to extract the most common colors used in images.
It can open an image file in the GIF, JPEG or PNG format. Then it traverses the image and returns an array with the most used color tones.
|An image may be made of dots of many colors. Finding which colors are most frequently used in an image, is relatively easy. It is a matter of building an histogram.
However, if you want to find which are the dominant tones, that is much harder, as the most frequently used colors may not be exactly the dominant tones.
This class provides a solution for finding the topmost dominant tones used in an image, using only PHP code without any special PHP extensions, except for the GD library functions.
That may be useful to use background colors on a page that match the dominant tones used in images presented in that page.