Does a brightness factor add a constant or scale intensities?
Brightness.enhance scales brightness. Zero gives black and one preserves the source.
Pixel experiment and interpretation
Double intensities 60 and 160. The second clips to the eight-bit ceiling; division afterward cannot reconstruct the highlight.
from PIL import Image, ImageEnhance
def row(values):
return Image.frombytes('L', (len(values), 1), bytes(values))
list(ImageEnhance.Brightness(row([60,160])).enhance(2).tobytes())Result [120, 255]
中文
Pillow 的亮度因子是加常数还是乘比例?
Brightness.enhance 用因子调节亮度,零得到黑图,一保持原图。
像素实验与适用边界
将灰度 60 和 160 一起翻倍,后者在八位上限截断。数据增强后不能靠除以二完整恢复亮区。
from PIL import Image, ImageEnhance
def row(values):
return Image.frombytes('L', (len(values), 1), bytes(values))
list(ImageEnhance.Brightness(row([60,160])).enhance(2).tobytes())结果 [120, 255]