Skip to content

scripts/shrink-icons.py

7 lines · 357 B · Python
Raw
# Quantize rendered PNG icons to a 256-color palette (keeps alpha) to keep the app bundle small.
from PIL import Image
import glob
for f in glob.glob('public/icons/*.png') + ['.kody/icon.png']:
    im = Image.open(f).convert('RGBA')
    im.quantize(colors=256, method=Image.Quantize.FASTOCTREE, dither=Image.Dither.NONE).save(f, optimize=True)
    print(f)