PHP Classes

PHP Detect Image Background Color: Detect the dominant color used in an image

Recommend this page to a friend!
     
  Info   Example   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStarStar 79%Total: 195 All time: 8,536 This week: 38Up
Version License PHP version Categories
php-detect-image-col 1.0.0GNU General Publi...5PHP 5, Graphics
Description 

Author

This class can detect the dominant color used in an image.

It can take the path of an image file in JPEG or PNG formats and can create a scaled down image that will uses mainly the color that is dominant in an image.

The class can return the image dominant color as a string on RGB format or HTML tags to create an empty page with the body background color set to the image dominant color.

Picture of Hassane Moussa
  Performance   Level  
Innovation award
Innovation award
Nominee: 2x

Winner: 1x

 

Recommendations

What is the best PHP get dominant color from image class?
Extract and organize scanned images by dominant color

Extract the used color from the image.
Detect cloth on the image and extract the color of it

Example

<?php
 error_reporting
(0);
/***************************************************************************************
                            Main Using Class DetectImageColor
***************************************************************************************/
 
require('detectImageColor.php');
 
 
$path = "images3.png";

   
$mainDetectImageColor = new DetectImageColor($path);

   
//echo $mainDetectImageColor->getColorBackground($mainDetectImageColor->getHexa($path))."<br/>";
       
   
var_dump($mainDetectImageColor);
  
?>


  Files folder image Files (7)  
File Role Description
Plain text file detectImageColor.php Class Class source
Accessible without login Image file images1.jpg Icon Icon image
Accessible without login Image file images2.jpg Icon Icon image
Accessible without login Image file images3.png Icon Icon image
Accessible without login Plain text file index.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

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  
 100%
Total:195
This week:0
All time:8,536
This week:38Up
 User Ratings  
 
 All time
Utility:100%StarStarStarStarStarStar
Consistency:100%StarStarStarStarStarStar
Documentation:91%StarStarStarStarStar
Examples:100%StarStarStarStarStarStar
Tests:-
Videos:-
Overall:79%StarStarStarStar
Rank:30