vitorbari / image-to-color-palette
A PHP class that generates color palettes from images
1.0.2
2015-08-22 18:34 UTC
Requires
- php: >=5.3.0
- ext-gd: *
This package is auto-updated.
Last update: 2025-01-11 02:12:11 UTC
README
A PHP class that generates color palettes from images.
Requirements
- GD Library
Installation
First, pull in the package through Composer.
"require": { "vitorbari/image-to-color-palette": "~1.0" }
Usage
// Create new ColorPalette object $palette = new VitorBari\ImageToColorPalette\ColorPalette(); // Set image $palette->set_image_file('images/myimg.jpg'); // Get colors $colors = $palette->get_palette(); // Print colors echo "<pre>"; print_r($colors);
Examples
Result:
Array
(
[0] => #FF00CC
[1] => #00FF99
[2] => #00FF66
[3] => #00FFCC
[4] => #99FF00
)
Result:
Array
(
[0] => #6666CC
[1] => #FFFFFF
[2] => #000000
[3] => #666699
[4] => #666666
)
Result:
Array
(
[0] => #0066CC
[1] => #003366
[2] => #CCCCCC
[3] => #336633
[4] => #006699
)