From 46012d35a4115892e17954b99a0e93ad5ff65cda Mon Sep 17 00:00:00 2001 From: Furrtek Date: Thu, 22 Dec 2022 04:32:47 +0100 Subject: [PATCH] Silly luma threshold bug :( --- tools_python/img2dm.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools_python/img2dm.py b/tools_python/img2dm.py index 623c6b2..7c7ff97 100644 --- a/tools_python/img2dm.py +++ b/tools_python/img2dm.py @@ -14,9 +14,9 @@ def image_convert(image, color_pass): pixels = [] for row in image: for rgb in row: - luma = 0.21 * rgb[0] + 0.72 * rgb[1] + 0.07 * rgb[2] + luma = (0.21 * rgb[0] + 0.72 * rgb[1] + 0.07 * rgb[2]) / 255 if color_pass: - pixels.append(0 if luma >= 0.33 and luma < 0.66 else 1) # 0 codes color (anything mid grey) + pixels.append(0 if luma >= 0.1 and luma < 0.9 else 1) # 0 codes color (anything mid grey) else: pixels.append(0 if luma < 0.5 else 1) # 0 codes black