Last active
June 6, 2016 03:37
-
-
Save rsky/422f3e687d47588fb63a01418adf1674 to your computer and use it in GitHub Desktop.
透明チャンネルをそのままに塗り潰し色を変える
This file contains 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 | |
// usage: php change_fill_color.php '#cafe00' < in.png > out.png | |
$color = $_SERVER['argv'][1]; | |
$in = new Imagick(); | |
$in->readImageFile(STDIN); | |
$size = $in->getImageGeometry(); | |
$out = new Imagick(); | |
$out->newImage($size['width'], $size['height'], $color); | |
$out->setImageFormat('png'); | |
$out->compositeImage($in, Imagick::COMPOSITE_COPYOPACITY, 0, 0); | |
$out->writeImageFile(STDOUT); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment