From 03d5c677aacf8f2aa8ff21c84f60532a462b16d8 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 18 Jan 2018 10:58:18 +0100 Subject: [PATCH] convert icons to RGB if output is jpg, fixes #3073 --- scripts/item_icon.pandora.py | 5 +++-- scripts/list_icon.pandora.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/scripts/item_icon.pandora.py b/scripts/item_icon.pandora.py index 0cace0fbb..3eb62e631 100755 --- a/scripts/item_icon.pandora.py +++ b/scripts/item_icon.pandora.py @@ -1,12 +1,11 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 -from __future__ import division import os +import sys from PIL import Image from optparse import OptionParser -import sys root_dir = os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) static_root = os.path.join(os.path.dirname(__file__), 'data') @@ -44,6 +43,8 @@ def render_icon(frame, timeline, icon): # we're using jpegs with border-radius # mask_image = Image.open(os.path.join(static_root, 'iconMask.png')) # icon_image.putalpha(mask_image) + if icon.endswith('.jpg'): + icon_image = icon_image.convert('RGB') icon_image.save(icon) def main(): diff --git a/scripts/list_icon.pandora.py b/scripts/list_icon.pandora.py index 0a65e07c0..873dc2e59 100755 --- a/scripts/list_icon.pandora.py +++ b/scripts/list_icon.pandora.py @@ -1,15 +1,13 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- # vi:si:et:sw=4:sts=4:ts=4 -from __future__ import division import os +import sys from PIL import Image from PIL import ImageDraw from optparse import OptionParser from ox.image import drawText, wrapText -import sys - root_dir = os.path.normpath(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) static_root = os.path.join(os.path.dirname(__file__), 'data') @@ -39,6 +37,8 @@ def render_list_icon(frames, icon): mask_image = Image.open(os.path.join(static_root, 'iconMask.png')) mask_image = mask_image.resize((icon_width, icon_height)) icon_image.putalpha(mask_image) + if icon.endswith('.jpg'): + icon_image = icon_image.convert('RGB') icon_image.save(icon) def main():