From e6d400281cdaaa51ab6267995be913b602130fe4 Mon Sep 17 00:00:00 2001 From: Chuck <33324927+ChuckBuilds@users.noreply.github.com> Date: Thu, 17 Apr 2025 21:36:09 -0500 Subject: [PATCH] Update weather_icons.py remove alpha threshold in weather_icons --- src/weather_icons.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/weather_icons.py b/src/weather_icons.py index 1d35bcbf..4735bf3b 100644 --- a/src/weather_icons.py +++ b/src/weather_icons.py @@ -163,12 +163,15 @@ class WeatherIcons: # to remove faint anti-aliasing pixels when pasting on black bg. # Pixels with alpha > 200 will be fully opaque, others fully transparent. try: - alpha = icon_to_draw.getchannel('A') - # Apply threshold: lambda function returns 255 if input > 200, else 0 - threshold_mask = alpha.point(lambda p: 255 if p > 200 else 0) + # alpha = icon_to_draw.getchannel('A') + # # Apply threshold: lambda function returns 255 if input > 200, else 0 + # threshold_mask = alpha.point(lambda p: 255 if p > 200 else 0) # Paste the icon using the thresholded mask - image.paste(icon_to_draw, (x, y), threshold_mask) + # image.paste(icon_to_draw, (x, y), threshold_mask) + + # Paste the icon directly with its original alpha channel + image.paste(icon_to_draw, (x, y), icon_to_draw) except Exception as e: print(f"Error processing or pasting icon for condition '{condition}' at ({x},{y}): {e}") # Fallback or alternative handling if needed