Image Color Extract

Demo

test image
ColorColor CodePercentage
#f0a8000.221667
#6060300.174286
#d878000.155595
#4848180.097857
#9018180.076905
#3018180.049107
#7878480.048929
#c030180.031667
#d860180.022738
#1818000.022083
(1-255)

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.

Download (version 1.3)

colorextract_1_3.zip zip format (553kb)

or clone the code from GitHub: https://github.com/keplerg/color-extract

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.

wp-login