PHP Classes

Color extract: Extracts the most common colors used in images

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 63%Total: 4,907 This week: 1All time: 556 This week: 51Up
Version License Categories
colorextract 1.0.0BSD LicenseGraphics
Description 

Author

This class can be used to extract the most common colors used in images.

It can open an image file in the GIF, JPEG or PNG format. Then it traverses the image and returns an array with the most used color tones.

Innovation Award
PHP Programming Innovation award nominee
September 2006
Number 10
An image may be made of dots of many colors. Finding which colors are most frequently used in an image, is relatively easy. It is a matter of building an histogram.

However, if you want to find which are the dominant tones, that is much harder, as the most frequently used colors may not be exactly the dominant tones.

This class provides a solution for finding the topmost dominant tones used in an image, using only PHP code without any special PHP extensions, except for the GD library functions.

That may be useful to use background colors on a page that match the dominant tones used in images presented in that page.

Manuel Lemos
Picture of Csongor Zalatnai
Name: Csongor Zalatnai <contact>
Classes: 1 package by
Country: Hungary Hungary
Age: 35
All time rank: 6035 in Hungary Hungary
Week rank: 47 Up3 in Hungary Hungary Up
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files (4)  
File Role Description
Plain text file colors.inc.php Class The main class
Accessible without login Plain text file example.php Example Example script
Accessible without login Image file test.jpg Photo Test image no. 1
Accessible without login Image file test2.jpg Photo Test image no. 2

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:4,907
This week:1
All time:556
This week:51Up
User Ratings User Comments (3)
 All time
Utility:91%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:-
Examples:83%StarStarStarStarStar
Tests:-
Videos:-
Overall:63%StarStarStarStar
Rank:833
 
great wooork
14 years ago (Saroj Kumar)
65%StarStarStarStar
Does exactly what it says.
14 years ago (Gilbert Bates)
70%StarStarStarStar
Worked right out of the box.
15 years ago (Cameron Rout)
65%StarStarStarStar