mauriciourrego / colorcube-php
Dominant color extraction from RGB images — PHP port of Ole Krause-Sparman's algorithm.
Installs: 37
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/mauriciourrego/colorcube-php
Requires
- ext-gd: *
README
composer require mauriciourrego/colorcube-php
colorcube-php
Dominant color extraction from RGB images — PHP port of Ole Krause-Sparman's algorithm.
Demo
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);