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

Imagick::transparentPaintImage

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

Imagick::transparentPaintImage — Paints pixels transparent

Description

代码语言:javascript
复制
bool Imagick::transparentPaintImage ( mixed $target , float $alpha , float $fuzz , bool $invert )

Paints pixels matching the target color transparent. This method is available if Imagick has been compiled against ImageMagick version 6.3.8 or newer.

Parameters

target

The target color to paint

alpha

The level of transparency: 1.0 is fully opaque and 0.0 is fully transparent.

fuzz

The amount of fuzz. For example, set fuzz to 10 and the color red at intensities of 100 and 102 respectively are now interpreted as the same color.

invert

If TRUE paints any pixel that does not match the target color.

Return Values

Returns TRUE on success.

Examples

Example #1 Imagick::transparentPaintImage()

代码语言:javascript
复制
<?php
function?transparentPaintImage($color,?$alpha,?$fuzz)?{
????$imagick?=?new?\Imagick(realpath("images/BlueScreen.jpg"));

????//Need?to?be?in?a?format?that?supports?transparency
????$imagick->setimageformat('png');

????$imagick->transparentPaintImage(
????????$color,?$alpha,?$fuzz?*?\Imagick::getQuantum(),?false
????);

????//Not?required,?but?helps?tidy?up?left?over?pixels
????$imagick->despeckleimage();

????header("Content-Type:?image/png");
????echo?$imagick->getImageBlob();
}

?>

← Imagick::transformImageColorspace

Imagick::transposeImage →

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

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

扫码关注腾讯云开发者

领取腾讯云代金券

http://www.vxiaotou.com