php Imagick::levelImage usage

£可爱£侵袭症+ 提交于 2019-12-02 04:03:46

问题



I have trying hard, but can't make this method works properly.
The usage format is

Imagick::levelImage ( float $blackPoint , float $gamma , float $whitePoint [, int $channel = Imagick::CHANNEL_ALL ] );

I try use it like

$img->levelImage (0, 1.0, 255);

and

$img->levelImage (255, 1.0, 0);

or even like

$img->levelImage (-0.5, 1.0, 5.6);

but without any success.
Output image is either almost black or almost white.
All other imagick methods I use work fine, but this one is just a back-breaker for me))
I can't find any examples of usage this imagick method on the net so need help!
Maybe somebody have an good working example, help me please:)


回答1:


Looking at the ImageMagick documentation for LevelImage:

Specify the levels where the black and white points have the range of 0-QuantumRange, and gamma has the range 0-10

So a sensible call from PHP might look like this:

//bool Imagick::levelImage ( float $blackPoint , float $gamma , float $whitePoint [, int $channel = Imagick::CHANNEL_ALL ] )
$img->levelImage (20, 5, 220);

I'm guessing the QuantumRange is set at 255, if not, try calling Imagick::getQuantumRange to find out what it is.

If it still doesn't seem to work, I'll figure out what's wrong by writing example code.



来源:https://stackoverflow.com/questions/4539307/php-imagicklevelimage-usage

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!