首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Imagick::transformImageColorspace

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

Imagick::transformImageColorspace — Transforms an image to a new colorspace.

Description

代码语言:javascript
复制
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 or FALSE on failure.

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.

代码语言:javascript
复制
<?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

  • Imagick::setColorSpace() - Set colorspace

Examples

Example #2 Imagick::transformImageColorspace()

代码语言:javascript
复制
<?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();
}

?>

← Imagick::transformImage

Imagick::transparentPaintImage →

代码语言:txt
复制
 ? 1997–2017 The PHP Documentation Group

Licensed under the Creative Commons Attribution License v3.0 or later.

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com