Last active
August 8, 2017 14:43
-
-
Save deathlyfrantic/3a02a23f5181e384055a to your computer and use it in GitHub Desktop.
get useful imagemagick colorspace constants from getImageColorspace() as opposed to mystery integers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$reflection = new \ReflectionClass("\Imagick"); | |
$colorspaces = array_flip( | |
array_filter( | |
$reflection->getConstants(), | |
function ($k) { | |
return mb_strpos($k, "COLORSPACE") !== false; | |
}, | |
ARRAY_FILTER_USE_KEY | |
) | |
); | |
// print_r($colorspaces); // if you want a list uncomment this | |
$image = new \Imagick($path); | |
echo $colorspaces[$image->getImageColorspace()]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment