Create a PHP script which takes a source file, [login to view URL], and outputs a list of up to 16 colors. The goal is to list the most important colors (palette) in an image. We will use this data to categorize images and color schemes. See attached image for an illustration.
DETAILS:
* Wrap your script in a class
* Use imagetruecolortopalette() to generate a palette of up to 64 colors for an image
* Combine similar colors (very small color distance). Measure color distance using CIE L*u*v* color space (assume D65). Possible sources of equations:
[login to view URL]
[login to view URL]
[login to view URL]~burkardt/f_src/colors/[login to view URL]
[login to view URL]
* Count the number of each pixel, drop colors used less than 0.1%
* Continue to combine colors, until there are less than 8 colors. When reducing colors, increase the chance of colors being combined if they are similar in HUE, so use CIE L*u*v* scaled by the hue similarity.)
* Output is: a list of color hex codes, RGB decimals, and a file, [login to view URL] containing 8 16x16pixel squares of each color.
We can discuss other methods if you have other ideas.