PHP Classes

PHP Dominant Color: Create image with color of another dominant color

Recommend this page to a friend!
  Info   View files Documentation   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 52%Total: 177 All time: 8,746 This week: 206Up
Version License PHP version Categories
image-color 1.0.0MIT/X Consortium ...5PHP 5, Graphics


This class can create an image with color of another image dominant color.

It can take a given image and resizes it to a small size using ImageMagick extension to apply a gaussian filter during resizing and then use the quantize filter to reduce the colors and find out the dominant color.

The class can generate a new image using the dominant color and returns it as a data URL string for a GIF image with one pixel of that color.

Innovation Award
PHP Programming Innovation award nominee
March 2017
Number 2

Prize: One big elePHPant Plush Mascott
Some applications need to display an image in a background that matches the most common color of the image.

This package can find the dominant color of an image and creates a new image in the GIF format with one pixel using that dominant color.

Manuel Lemos
Picture of Arnel Labarda
  Performance   Level  
Name: Arnel Labarda <contact>
Classes: 6 packages by
Country: Philippines Philippines
Age: 37
All time rank: 247822 in Philippines Philippines
Week rank: 280 Up3 in Philippines Philippines Up
Innovation award
Innovation award
Nominee: 4x

Winner: 1x



Creates a data-uri based on the image dominant color.


ImageMagick extension should be present.


require './vendor/autoload.php';

$image_url = '';

$i = new ImageColor\ImageColor($image_url);

echo $i->get_data_uri();



  Files folder image Files  
File Role Description
Files folder imagesrc (1 directory)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  src  
File Role Description
Files folder imageImageColor (1 file)

  Files folder image Files  /  src  /  ImageColor  
File Role Description
  Plain text file ImageColor.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:8,746
This week:206Up
 User Ratings  
 All time