mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-11 13:23:00 +00:00
better handling for png transparency in broadcast logos
This commit is contained in:
@@ -260,6 +260,9 @@ class OddsTickerManager:
|
|||||||
logger.debug(f"Attempting to load logo from path: {logo_path}")
|
logger.debug(f"Attempting to load logo from path: {logo_path}")
|
||||||
if os.path.exists(logo_path):
|
if os.path.exists(logo_path):
|
||||||
logo = Image.open(logo_path)
|
logo = Image.open(logo_path)
|
||||||
|
# Convert palette images with transparency to RGBA to avoid PIL warnings
|
||||||
|
if logo.mode == 'P' and 'transparency' in logo.info:
|
||||||
|
logo = logo.convert('RGBA')
|
||||||
logger.debug(f"Successfully loaded logo for {team_abbr} from {logo_path}")
|
logger.debug(f"Successfully loaded logo for {team_abbr} from {logo_path}")
|
||||||
return logo
|
return logo
|
||||||
else:
|
else:
|
||||||
@@ -273,6 +276,9 @@ class OddsTickerManager:
|
|||||||
# Try to load the downloaded logo
|
# Try to load the downloaded logo
|
||||||
if os.path.exists(logo_path):
|
if os.path.exists(logo_path):
|
||||||
logo = Image.open(logo_path)
|
logo = Image.open(logo_path)
|
||||||
|
# Convert palette images with transparency to RGBA to avoid PIL warnings
|
||||||
|
if logo.mode == 'P' and 'transparency' in logo.info:
|
||||||
|
logo = logo.convert('RGBA')
|
||||||
logger.info(f"Successfully downloaded and loaded logo for {team_abbr}")
|
logger.info(f"Successfully downloaded and loaded logo for {team_abbr}")
|
||||||
return logo
|
return logo
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user