Skip to content

Instantly share code, notes, and snippets.

View keiron77's full-sized avatar

Keiron Roberts keiron77

View GitHub Profile
@keiron77
keiron77 / Reading the Colours From an Image Using PHP
Last active August 29, 2015 13:57
This script will process an image, take the colour used at each pixel and list them in order of use
function colorPalette($imageFile, $granularity = 5){
$granularity = max(1, abs((int)$granularity));
$colors = array();
$size = @getimagesize($imageFile);
if($size === false){
user_error("Unable to get image size data");
return false;
}
//$img = @imagecreatefromjpeg($imageFile);