當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python Wand level()用法及代碼示例

level()函數控製圖像的黑白邊界。與gamma()方法類似,可以使用gamma關鍵字參數來調整mid-point級別。黑白點參數的期望值介於0.0和1.0之間,代表百分比。

用法:
wand.image.evaluate(operator, value, channel)

參數:

參數 輸入類型 描述
black numbers.Real 黑點,占係統量子範圍的百分比。默認為0 ..
white numbers.Real 白點,占係統量子範圍的百分比。默認為1.0。
gamma numbers.Real 可選的伽瑪調節。值> 1.0會使圖像的中間色調變亮,而值<1.0會使圖像的中間色調變暗。
channel basestringl 頻道類型。

範例1:

源圖像:



# Import Image from wand.image module 
from wand.image import Image 
  
# Read image using Image function 
with Image(filename ="koala.jpeg") as img:
    img.level(0.2, 0.9, gamma = 1.1) 
    img.save(filename ="kl-level.jpeg")

輸出:

範例2:
將黑白值增加到0.5和0.7。

# Import Image from wand.image module 
from wand.image import Image 
  
# Read image using Image function 
with Image(filename ="koala.jpeg") as img:
    img.level(0.5, 0.7, gamma = 1.1) 
    img.save(filename ="kl-level2.jpeg")

輸出:




相關用法


注:本文由純淨天空篩選整理自RahulSabharwal大神的英文原創作品 Wand level() function in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。