Skip to content

Commit 15a5b7e

Browse files
committed
next
1 parent 5aae73e commit 15a5b7e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/PIL/ImageOps.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,17 @@ def dither_primary(image: Image.Image) -> Image.Image:
680680
px = band.load()
681681
for x in range(0, band.width - 1, 2):
682682
for y in range(0, band.height - 1, 2):
683-
value = (px[x, y] + px[x, y + 1] + px[x + 1, y] + px[x + 1, y + 1]) / 4
683+
v1 = px[x, y]
684+
v2 = px[x, y + 1]
685+
v3 = px[x + 1, y]
686+
v4 = px[x + 1, y + 1]
687+
688+
assert isinstance(v1, (int, float))
689+
assert isinstance(v2, (int, float))
690+
assert isinstance(v3, (int, float))
691+
assert isinstance(v4, (int, float))
692+
693+
value = (v1 + v2 + v3 + v4) / 4
684694

685695
px[x, y] = _dither_saturation(value, 0)
686696
px[x, y + 1] = _dither_saturation(value, 1)

0 commit comments

Comments
 (0)