2012-12-01 09:30:52 +03:00
|
|
|
from PIL import Image
|
|
|
|
import os, sys, shutil
|
|
|
|
|
|
|
|
img = Image.open(sys.argv[1])
|
|
|
|
if img.size != (1024,1024):
|
2023-10-27 19:47:43 +02:00
|
|
|
print("Input image must be 1024x1024. Provided image is %dx%d" % img.size)
|
2012-12-01 09:30:52 +03:00
|
|
|
|
|
|
|
os.mkdir("vcmi.iconset")
|
|
|
|
for i in [16, 32, 128, 256, 512]:
|
|
|
|
resized = img.resize((i, i), Image.ANTIALIAS)
|
|
|
|
resized.save("vcmi.iconset/icon_%dx%d.png" % (i, i))
|
|
|
|
|
|
|
|
resized2x = img.resize((2*i, 2*i), Image.ANTIALIAS)
|
|
|
|
resized2x.save("vcmi.iconset/icon_%dx%d@2x.png" % (i, i))
|
|
|
|
|
|
|
|
os.system("iconutil -c icns vcmi.iconset")
|
|
|
|
shutil.rmtree("vcmi.iconset")
|
|
|
|
|