Image Color Extract

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: http://www.phpclasses.org/browse/package/3370.html.

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.

Demo

test image
ColorColor CodePercentage
#f0a8000.229702
#6060300.175060
#d878000.150476
#4848180.100952
#9018180.076726
#3018180.059643
#7878480.045893
#c030180.030536
#d860180.027500
#1818000.023214
(1-255)

Download (version 1.2)

colorextract_1_2.zip zip format (553kb)

Requirements

  • 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

Contact

I hope you found this website useful.

Get Connected

blog comments powered by Disqus
wp-login