Skip to content

Dominant color extraction from RGB images — PHP port of Ole Krause-Sparman's algorithm.

License

Notifications You must be signed in to change notification settings

Mauricio-Urrego/colorcube-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Install

composer require mauriciourrego/colorcube-php

colorcube-php

Dominant color extraction from RGB images — PHP port of Ole Krause-Sparman's algorithm.

This is a PHP port of ColorCube, by Ole Krause-Sparmann. You can find an excellent description of how it works at that repo.

ColorCube is for dominant color extraction from RGB images. Given an image element, it returns a sorted array of hex colors.

Usage

$cc = new ColorCube( // all arguments are optional; these are the defaults:
  20,   // color-space resolution
  [255, 255, 255], // avoid color
  0.4,   // distinctness threshold
  0.2,  // brightness threshold
);
$image = imagecreatefromjpeg($image_url);
$colors = $cc->get_colors($image);

About

Dominant color extraction from RGB images — PHP port of Ole Krause-Sparman's algorithm.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages