Created
August 19, 2013 18:15
-
-
Save patrickocoffeyo/6272281 to your computer and use it in GitHub Desktop.
Turns an icon into website-ready touch icons.
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 optparse | |
import os | |
import Image | |
def main(): | |
p = optparse.OptionParser() | |
p.add_option('--source', '-s', default='') | |
p.add_option('--output', '-o', default='touch-icons/') | |
options, arguments = p.parse_args() | |
if not os.path.exists(options.output): | |
os.system('mkdir '+options.output) | |
image = Image.open(options.source) | |
ext = 'png' | |
#apple-touch-icons | |
sizes = [57,72,57,114,144] | |
for size in sizes: | |
sizeStr = str(size) | |
newImage = image.resize((size, size), Image.ANTIALIAS) | |
newImage.save(options.output+'apple-touch-icon'+sizeStr+'x'+sizeStr+'-precomposed.png') | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment