PHP code example of blainesch / imagecolor

1. Go to this page and download the library: Download blainesch/imagecolor library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

blainesch / imagecolor example snippets


use imageColor\models\Image;

$elephpant = new Image();
$elephpant->load(__DIR__ . '/php.jpg');
$elephpantColors = $elephpant->primaryColors();

$rubyShirt = new Image();
$rubyShirt->load(__DIR__ . '/ruby.jpg');
$rubyShirtColors = $rubyShirt->primaryColors();

print_r(array(
	'ruby.jpg' => $rubyShirtColors,
	'php.jpg' => $elephpantColors,
));