Skip to content

Instantly share code, notes, and snippets.

View kmvan's full-sized avatar
🌏
What is the end and ultimate purpose of the universe?

Km.Van kmvan

🌏
What is the end and ultimate purpose of the universe?
View GitHub Profile
@kmvan
kmvan / imagick_average_colour.php
Created September 14, 2017 10:16 — forked from paulferrett/imagick_average_colour.php
This function will get the average colour of an image file using PHP and Image Magick using the IMagick extension.
<?php
/**
* Get the average pixel colour from the given file using Image Magick
*
* @param string $filename
* @param bool $as_hex Set to true, the function will return the 6 character HEX value of the colour.
* If false, an array will be returned with r, g, b components.
*/
function get_average_colour($filename, $as_hex_string = true) {