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")
輸出:
相關用法
- Python Wand function()用法及代碼示例
- Python Wand gaussian_blur()用法及代碼示例
- Python Wand transform()用法及代碼示例
- Python Wand crop()用法及代碼示例
- Python Wand rotational_blur()用法及代碼示例
- Python Wand Image()用法及代碼示例
- Python Wand shade()用法及代碼示例
- Python Wand sharpen()用法及代碼示例
- Python Wand adaptive_sharpen()用法及代碼示例
- Python Wand noise()用法及代碼示例
- Python Wand blue_shift()用法及代碼示例
- Python Wand color_matrix()用法及代碼示例
- Python Wand unsharp_mask()用法及代碼示例
- Python Wand colorize()用法及代碼示例
- Python Wand fx()用法及代碼示例
注:本文由純淨天空篩選整理自RahulSabharwal大神的英文原創作品 Wand level() function in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。