Created
August 2, 2020 19:03
-
-
Save YiqinZhao/d35ac3f639c5c706b7270d205246ff4e to your computer and use it in GitHub Desktop.
Generate icon with multiple scaled size for Apple platform.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
img = Image.open('./icon.png') | |
sizes = [16, 32, 128, 256, 512] | |
for s in sizes: | |
img_resized = img.resize((s, s)) | |
img_resized.save(f'./dist/icon-{s}x{s}@1x.png') | |
t = s * 2 | |
img_resized = img.resize((t, t)) | |
img_resized.save(f'./dist/icon-{s}x{s}@2x.png') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment