(バージョン情報なし。おそらく SVN 版にしか存在しないでしょう)
Imagick::transformImageColorspace — Transforms an image to a new colorspace.
$colorspace
)Transforms an image to a new colorspace.
colorspace
The colorspace the image should be transformed to, one of the COLORSPACE constants e.g. Imagick::COLORSPACE_CMYK.
成功した場合に TRUE
を、失敗した場合に FALSE
を返します。
例1 Imagick::transformImageColorspace() example
Transforms an image to a new colorspace, and then extracts a single channel so that the individual channel values can be viewed.
<?php
function transformImageColorspace($imagePath, $colorSpace, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->transformimagecolorspace($colorSpace);
//channel should be one of the channel constants e.g. \Imagick::CHANNEL_BLUE
$imagick->separateImageChannel($channel);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>
例2 Imagick::transformImageColorspace()
<?php
function transformImageColorspace($imagePath, $colorSpace, $channel) {
$imagick = new \Imagick(realpath($imagePath));
$imagick->transformimagecolorspace($colorSpace);
$imagick->separateImageChannel($channel);
header("Content-Type: image/jpg");
echo $imagick->getImageBlob();
}
?>