bAngelov

Windows ico converter

Jun 8th, 2022 (edited)
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.59 KB | None | 0 0
  1. import os
  2. from PIL import Image
  3. #Requires pillow library
  4.  
  5. class Icos:
  6.  
  7.     def __init__(self):
  8.         print("Specify a valid image path please!")
  9.         self.getInput()
  10.  
  11.     def converticons(self, filename):
  12.         icon_sizes = [(16, 16), (24, 24), (32, 32), (48, 48), (64, 64), (128, 128), (256, 256)]
  13.         img = Image.open(filename)
  14.         img.save(filename + r".ico", sizes=icon_sizes)
  15.  
  16.     def getInput(self):
  17.         imgPath = str(input())
  18.         if os.path.exists(imgPath):
  19.             self.converticons(imgPath)
  20.         else:
  21.             print("File not found!")
  22.  
  23. Icos()
Add Comment
Please, Sign In to add comment