[UI] Convert all ico to png format for tracker icon
Some checks failed
Package / windows_package (x64, 1.2.19, 3.9) (push) Has been cancelled
Package / windows_package (x64, 2.0.7, 3.9) (push) Has been cancelled
Package / windows_package (x86, 1.2.19, 3.9) (push) Has been cancelled
Package / windows_package (x86, 2.0.7, 3.9) (push) Has been cancelled
CI / test-linux (3.10) (push) Has been cancelled
CI / test-linux (3.7) (push) Has been cancelled
CI / test-windows (3.10) (push) Has been cancelled
CI / test-windows (3.7) (push) Has been cancelled
Docs / build (push) Has been cancelled
Linting / lint (push) Has been cancelled

Closes: https://github.com/deluge-torrent/deluge/pull/472
This commit is contained in:
zakary 2024-08-31 22:32:00 -05:00 committed by Calum Lind
parent 98d01fbe35
commit 0b5addf58e
No known key found for this signature in database
GPG key ID: 90597A687B836BA3

View file

@ -461,15 +461,12 @@ class TrackerIcons(Component):
# Requires Pillow(PIL) to resize.
if icon and Image:
filename = icon.get_filename()
remove_old = False
with Image.open(filename) as img:
new_filename = os.path.splitext(filename)[0] + '.png'
if img.size > (16, 16):
new_filename = filename.rpartition('.')[0] + '.png'
img = img.resize((16, 16), Image.Resampling.LANCZOS)
img.save(new_filename)
if new_filename != filename:
remove_old = True
if remove_old:
os.remove(filename)
icon = TrackerIcon(new_filename)
return icon