From 200babd284e6110aac8a5707be98bb3120be6ad3 Mon Sep 17 00:00:00 2001 From: Mikey Sklar Date: Mon, 1 Jul 2024 09:06:44 -0700 Subject: [PATCH] Update bmp2led.py --- CLUE_Light_Painter/bmp2led.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CLUE_Light_Painter/bmp2led.py b/CLUE_Light_Painter/bmp2led.py index 26259dde1..d5c02ed86 100755 --- a/CLUE_Light_Painter/bmp2led.py +++ b/CLUE_Light_Painter/bmp2led.py @@ -339,6 +339,8 @@ def process(self, input_filename, output_filename, rows, # Accumulated error vals will all now be 0.0 to <2.0. # Quantizing err into a new uint8 ndarray, all values # will be 0 or 1. + # Convert float values in err to integers + err = [int(min(max(0, e), 255)) for e in err] err_bits = ulab.numpy.array(err, dtype=ulab.numpy.uint8) # Add the 1's back into 'got', increasing the # brightness of certain pixels by 1. Because the max