php Imagick::levelImage 使用 (php Imagick::levelImage usage)


問題描述

php Imagick::levelImage 使用 (php Imagick::levelImage usage)

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.

(by Maxthirtydot)

參考文件

  1. php Imagick::levelImage usage (CC BY‑SA 3.0/4.0)

#imagick #PHP






相關問題

Imagick 安裝錯誤 - 類未定義 (Imagick Installation Errors - Class Undefined)

GD/Imagick 不保存我的圖像 (GD/Imagick doesn't save my image)

Imagick 使用不同的目錄和數據庫 PDF 來縮略圖 JPG (Imagick using different directory and database PDF to thumbnail JPG)

如何在不損失分辨率和質量的情況下減小圖像尺寸(高度、寬度) (How to decrease image size(height, width) without losing its resolution and quality)

Đang cố gắng để tưởng tượng chạy trên PHP 5.4.3 ở Windows x64 (Trying to get imagick running on PHP 5.4.3 at Windows x64)

WampServer 和 Imagemagick,無法識別 imagick php 模塊 (WampServer and Imagemagick, imagick php module not recogized)

PHP Imagick:如何將自定義圖像屬性保存到文件 (PHP Imagick: How to save custom image property to file)

PHP Imagick - 顯示多圖像 TIFF 的第一片 (PHP Imagick - display first slice of mutli image TIFF)

可以加快 php/imagick 中的圖像加載速度 (Possible to speed up image loading in php/imagick)

PHP imagick 相當於 -define png:color-type=6 (PHP imagick equivalent of -define png:color-type=6)

php Imagick::levelImage 使用 (php Imagick::levelImage usage)

imagick:無法查詢字體度量 (Imagick: Failed to query the font metrics)







留言討論