Skip to content

Instantly share code, notes, and snippets.

@TimonPeng
Created August 20, 2016 13:16
Show Gist options
  • Select an option

  • Save TimonPeng/14f130adbef8af24e13155a986828aaa to your computer and use it in GitHub Desktop.

Select an option

Save TimonPeng/14f130adbef8af24e13155a986828aaa to your computer and use it in GitHub Desktop.
Generate .ico files.
#!/usr/bin/env python
#coding=utf-8
# pip install Pillow
# http://pillow.readthedocs.io/
from PIL import Image
filename = r'logo.png'
img = Image.open(filename)
img.save('logo.ico')
# icon_sizes = [(128, 128)]
# icon_sizes = [(16, 16), (24, 24), (32, 32), (48, 48), (64, 64), (128, 128), (255, 255)]
# img.save('logo.ico', sizes=icon_sizes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment