Last active
December 13, 2017 16:06
-
-
Save FreeSlave/6ce18ec46c9cd70087b2c7a55d69e4f8 to your computer and use it in GitHub Desktop.
Python PIL script to generate tga from ico
This file contains hidden or 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
| #!/usr/bin/python | |
| import sys | |
| import os.path | |
| from PIL import Image | |
| loadpath = 'game.ico' | |
| if len(sys.argv) > 1: | |
| loadpath = sys.argv[1] | |
| savepath = os.path.splitext(loadpath)[0] + '.tga' | |
| if len(sys.argv) > 2: | |
| savepath = sys.argv[2] | |
| icon = Image.open(loadpath) | |
| size = (64,64) | |
| if icon.size[0] < 64: | |
| size = icon.size | |
| icon.info["orientation"] = 1 | |
| icon.resize(size).save(savepath, 'TGA') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment