From bdd29b3fe0c4abda6cd959488177b63f7027996b Mon Sep 17 00:00:00 2001 From: ChuckBuilds <33324927+ChuckBuilds@users.noreply.github.com> Date: Fri, 18 Apr 2025 09:58:27 -0500 Subject: [PATCH] Fix NHL logo rendering alpha channel issues - Convert RGBA images to RGB before pasting to avoid alpha channel errors - Remove unnecessary mask parameter from paste operations --- src/nhl_scoreboard.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/nhl_scoreboard.py b/src/nhl_scoreboard.py index d6d281bb..9c52b32f 100644 --- a/src/nhl_scoreboard.py +++ b/src/nhl_scoreboard.py @@ -1157,7 +1157,8 @@ class NHLScoreboardManager: # Create a new RGBA image for compositing temp_img = Image.new('RGBA', img.size, (0, 0, 0, 0)) temp_img.paste(away_logo, (away_logo_x, paste_y)) - img.paste(temp_img, (0, 0), temp_img) + # Convert to RGB before pasting to avoid alpha channel issues + img.paste(temp_img.convert('RGB'), (0, 0)) logging.debug(f"[NHL] Successfully rendered away logo: {game_details['away_logo_path']}") except Exception as e: @@ -1185,7 +1186,8 @@ class NHLScoreboardManager: # Create a new RGBA image for compositing temp_img = Image.new('RGBA', img.size, (0, 0, 0, 0)) temp_img.paste(home_logo, (home_logo_x, paste_y)) - img.paste(temp_img, (0, 0), temp_img) + # Convert to RGB before pasting to avoid alpha channel issues + img.paste(temp_img.convert('RGB'), (0, 0)) logging.debug(f"[NHL] Successfully rendered home logo: {game_details['home_logo_path']}") except Exception as e: @@ -1274,7 +1276,8 @@ class NHLScoreboardManager: # Create a new RGBA image for compositing temp_img = Image.new('RGBA', img.size, (0, 0, 0, 0)) temp_img.paste(away_logo, (away_logo_x, paste_y)) - img.paste(temp_img, (0, 0), temp_img) + # Convert to RGB before pasting to avoid alpha channel issues + img.paste(temp_img.convert('RGB'), (0, 0)) logging.debug(f"[NHL] Successfully rendered away logo: {game_details['away_logo_path']}") except Exception as e: @@ -1307,7 +1310,8 @@ class NHLScoreboardManager: # Create a new RGBA image for compositing temp_img = Image.new('RGBA', img.size, (0, 0, 0, 0)) temp_img.paste(home_logo, (home_logo_x, paste_y)) - img.paste(temp_img, (0, 0), temp_img) + # Convert to RGB before pasting to avoid alpha channel issues + img.paste(temp_img.convert('RGB'), (0, 0)) logging.debug(f"[NHL] Successfully rendered home logo: {game_details['home_logo_path']}") except Exception as e: