GoLang Imagick::transformImageColorspace

request it (317)
GoLang replacement for PHP's Imagick::transformImageColorspace [edit | history]



Do you know a GoLang replacement for PHP's Imagick::transformImageColorspace? Write it!

PHP Imagick::transformImageColorspace

PHP original manual for Imagick::transformImageColorspace [ show | php.net ]

Imagick::transformImageColorspace

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

Imagick::transformImageColorspaceTransforms an image to a new colorspace

Description

bool Imagick::transformImageColorspace ( int $colorspace )

Transforms an image to a new colorspace.

Parameters

colorspace

The colorspace the image should be transformed to, one of the COLORSPACE constants e.g. Imagick::COLORSPACE_CMYK.

Return Values

Returns TRUE on success.

Examples

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

See Also

Examples

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

?>