I took a few hours today to review some of my old code and update it. The Color Palette Generator is an old project of mine — probably 3 years old now — which takes images and, as it says on the tin, creates a color palette from it.
The algorithm introduced originally was fairly simple:

In this method, you would choose a “grid” (in the above, 3×3). The image would have 9 lines drawn through it and where those lines meet, the color of the underlying pixel would be used as the “palette”. While this wasn’t “wrong”, it wasn’t perfect. Many times the pixel under it would not be incorrect, per se, but it wasn’t very accurate.
Since writing the code, a few other methods have surfaced, one of my favorite, however, is the resize-and-sample. This process is very straight forward, and tends to deliver reliable results despite appearing to “wash out” some of the more vibrant portions of the image.

In this method, the image is resized down to the grid size (so, 3px by 3px) and the resizing causes a “blurring” of the image and all the colors get averaged down to 9 total pixels. These remaining pixels are now the average colors of the image.
Both methods are valid, and sometimes one is better than the other, however now they are both available. Pick a favorite and enjoy :)
Additionally, the updated source code is now freely available for download. Please note! I will not provide support for this code.