PHP code example of vitorbari / image-to-color-palette

1. Go to this page and download the library: Download vitorbari/image-to-color-palette 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/ */

    

vitorbari / image-to-color-palette example snippets


// 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);