downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Imagick::pingImage> <Imagick::paintOpaqueImage
Last updated: Fri, 13 Nov 2009

view this page in

Imagick::paintTransparentImage

(PECL imagick 2.0.0)

Imagick::paintTransparentImage色にマッチするピクセルを塗りつぶし色に変更する

説明

bool Imagick::paintTransparentImage ( mixed $target , float $alpha , float $fuzz )
警告

この関数は、 現在のところ詳細な情報はありません。引数のリストのみが 記述されています。

塗りつぶし色に指定した色にマッチするピクセルを変更します。

パラメータ

target

この対象色を変更して、画像の不透明度を指定します。

alpha

不透明度レベル。1.0 は完全な不透明、0.0 は完全な透明を表します。

fuzz

画像の fuzz 値。 どの程度の色を「同じ色」とみなすかを表します。

返り値

成功した場合に TRUE を返します。

エラー / 例外

エラー時に ImagickException をスローします。

変更履歴

バージョン 説明
2.1.0 色を表す文字列を最初のパラメータとして指定できるようになりました。 これまでのバージョンでは ImagickPixel オブジェクトしか指定できませんでした。



add a note add a note User Contributed Notes
Imagick::paintTransparentImage
Anonymous
06-Mar-2009 04:11
Actually it does seem to work just not the way expected perhaps.

Looking at the fuzz option on ImageMagick's site (http://www.imagemagick.org/script/command-line-options.php#fuzz), "The distance can be in absolute intensity units or, by appending % as a percentage of the maximum possible intensity (255, 65535, or 4294967295)."

As it requires a float, the percentage value won't work so it actually one of the max intensity values.  In my case, the images I was working with seemed to have max intensity values of 65535.  So a fuzz of 6500, for roughly 10%, seemed to do the trick.

The part that might be problematic though is how do you determine the max intensity of a color/image?  Using a static 6500 would be fine until I would have to convert an image with a max intensity other than 65535.  If it's 255 it would wipe the entire image.  Or fall far short on the fuzz with the larger value.
paziek at gmail dot com
13-Feb-2009 02:53
Fuzz attribute doesn't work here.

#!/usr/bin/php
<?php

if(!isset($argv[1])) die("input file\n");

$im = new Imagick( $argv[1] );
$im->paintTransparentImage('rgb(246,241,230)', 0.0, 10);

file_put_contents('transparent_'.$argv[1], $im);
?>

Will "remove" only colors that match exactly rgb(246,241,230)

Imagick::pingImage> <Imagick::paintOpaqueImage
Last updated: Fri, 13 Nov 2009
 
 
show source | credits | sitemap | contact | advertising | mirror sites