From 594276c45e7ec4e78f29d6ff61a958bb079aa42a Mon Sep 17 00:00:00 2001 From: wiredfool Date: Sun, 5 Jan 2014 22:20:07 -0800 Subject: [PATCH] existing behaviour is to clamp to max, not bitmask --- PIL/PyAccess.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/PIL/PyAccess.py b/PIL/PyAccess.py index 8ccff11ed..5f56e2bca 100644 --- a/PIL/PyAccess.py +++ b/PIL/PyAccess.py @@ -112,6 +112,7 @@ class _PyAccess32_4(PyAccess): def set_pixel(self, x,y, color): pixel = self.pixels[y][x] # tuple + #undone clamp? pixel.r, pixel.g, pixel.b, pixel.a = color class _PyAccess8(PyAccess): @@ -124,10 +125,10 @@ class _PyAccess8(PyAccess): def set_pixel(self, x,y, color): try: # integer - self.pixels[y][x] = color & 0xFF + self.pixels[y][x] = min(color,255) except: # tuple - self.pixels[y][x] = color[0] & 0xFF + self.pixels[y][x] = min(color[0],255) mode_map = {'1': _PyAccess8,