Why can a bright pixel sum wrap back to a dark value?

add_modulo performs addition modulo 256 for eight-bit channels, wrapping at the upper bound.

Pixel experiment and interpretation

Like a rolling counter, 250 plus 12 crosses the dial boundary. An exposure sum needs a wider accumulator to retain the total.

from PIL import Image, ImageChops

def row(values):
    return Image.frombytes('L', (len(values), 1), bytes(values))

ImageChops.add_modulo(row([250]),row([12])).getpixel((0,0))

Result 6

中文

像素累加为何可能从亮处突然回到暗处?

add_modulo 对八位通道作模 256 加法,越过上限后从零继续计数。

像素实验与适用边界

像里程表一样,250 再加 12 会翻过量程。曝光叠加若需要保留真实总量,要换宽位深的累加器。

from PIL import Image, ImageChops

def row(values):
    return Image.frombytes('L', (len(values), 1), bytes(values))

ImageChops.add_modulo(row([250]),row([12])).getpixel((0,0))

结果 6

References / 参考来源

Keep reading / 继续阅读