Imagick::transformImageColorspace

(No version information available, might only be in Git)

Imagick::transformImageColorspaceTransforms an image to a new colorspace

说锟斤拷

Imagick::transformImageColorspace ( int $colorspace ) : bool

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锟斤拷

锟斤拷锟斤拷

Example #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();
}
?>

锟轿硷拷

锟斤拷锟斤拷

Example #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();
}

?>