Image Color Extract


test image
ColorColor CodePercentage

The Image Color Extract PHP class pulls the most common colors out of an image file. The color values are in hexidecimal. You can try it out below. Upload a file or use the sample image provided. This class was originally written by Csongor Zalatnai. You can get his original version here:

I added added some enhancements to this class:

  • Allow you to select the quantization delta. The smaller the delta the more accurate the color. This also increases the number of similar colors though.
  • Added a filter to reduce brightness variants of the same color.
  • Added a filter to reduce gradient variants ( useful for logos ).
  • Changed color counts to percentages.

Download (version 1.3) zip format (553kb)


  • PHP 4.0.2 or higher
  • GD2 image library

Link to this page

Copy and paste the following into your HTML:

Creates this link:

Image Color Extract Using PHP

blog comments powered by Disqus


I hope you found this website useful.

Get Connected