Python中的魔杖级别()函数
level()函数控制图像的黑白边界。与 gamma() 方法类似,可以使用 gamma 关键字参数调整中点级别。黑点和白点参数期望值介于 0.0 和 1.0 之间,代表百分比。
Syntax :
Parameters :
Parameter Input Type Description black numbers.Real Black point, as a percentage of the system’s quantum range. Defaults to 0.. white numbers.Real White point, as a percentage of the system’s quantum range. Defaults to 1.0.
gamma numbers.Real Optional gamma adjustment. Values > 1.0 lighten the image’s midtones while values < 1.0 darken them.
channel basestring The channel type.
示例 1:
源图像:
Python3
wand.image.evaluate(operator, value, channel)
Python3
# 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。
Python3
# 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")
输出 :