Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- from PIL import Image
- #Requires pillow library
- class Icos:
- def __init__(self):
- print("Specify a valid image path please!")
- self.getInput()
- def converticons(self, filename):
- icon_sizes = [(16, 16), (24, 24), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)]
- img = Image.open(filename)
- img.save(filename + r".ico", sizes=icon_sizes)
- def getInput(self):
- imgPath = str(input())
- if os.path.exists(imgPath):
- self.converticons(imgPath)
- else:
- print("File not found!")
- Icos()
Add Comment
Please, Sign In to add comment