Created
April 11, 2014 19:04
-
-
Save ayushgoel/10492856 to your computer and use it in GitHub Desktop.
Create icons from an image for iOS with predefined sizes
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
#! /usr/bin/python3 | |
import PIL.Image as Image | |
import sys | |
imageNamePrefix = "Icon" | |
extension = ".png" | |
sizesToConvertTo = [(58, 58), (80, 80), (120, 120)]; | |
def saveImage(image, imageName): | |
image.save(imageNamePrefix + imageName + extension) | |
def convertImageToSizes(image): | |
for size in sizesToConvertTo: | |
convertedImage = image.resize(size, Image.ANTIALIAS) | |
saveImage(convertedImage, str(size[0])) | |
if __name__ == '__main__': | |
imageName = sys.argv[1] | |
image = Image.open(imageName) | |
convertImageToSizes(image) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment