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

This commit is contained in:
ChuckBuilds
2025-04-18 09:58:27 -05:00
parent 285e6f6524
commit bdd29b3fe0

View File

@@ -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: