From e014cdbcce234a91898d963c6e0fde3e8d89f406 Mon Sep 17 00:00:00 2001 From: Niles Rogoff Date: Thu, 21 Jul 2016 11:13:04 -0700 Subject: [PATCH] Fixed bug where nonrandom dithering would only be half as effective as it should be --- 2bit.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/2bit.py b/2bit.py index 71abda5..7346f6e 100644 --- a/2bit.py +++ b/2bit.py @@ -75,7 +75,8 @@ for x in range(image.width): if use_non_random_dither: val = 255*float(counter)/counter_max # goes from 0 to 255 val *= dither # for dither = .1 and counter max = 4 it goes from 0 to 25.5 - val -= 255 * dither / 2 # for those values it goes from -12.75 to 12.75 + val *= 2 # 0 to +51 + val -= 255 * dither # -25.5 to +25.5 val = int(val) color[z] += val color[z] = min(color[z], 255)