├── LICENSE
├── README.md
├── demo.PNG
├── icon.ico
├── icon.png
└── main.py
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Insanecodes
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Icon-Maker-GUI [](https://forthebadge.com)
2 | 
3 | [](https://github.com/insanecodes/Icon-Maker-GUI)
4 | [](https://github.com/insanecodes/Icon-Maker-GUI/fork)
5 |
6 | A Icon Maker GUI Made Using Python 3.9.0 .
7 | It will take any image and convert it to ICO file, for web site favicon or Windows applications.
8 | Hope You Will Like It and you can also use the code to make your own version.
9 |
10 | >#### To Run, simply open your terminal and go the source directory and type ``python main.py``.
11 | >- Click on 'Choose File' button and pick any image from any location.
12 | >- Select the 'Convert to ICO' button and pick the location where the file will be saved.
13 | ## Requirements
14 | 1. Pillow
15 | 2. Os
16 | 3. Tkinter
17 |
18 | ---
19 |
20 | ### Installing The Pillow Module:
21 | * For Linux: Open Terminal then type ```pip3 install Pillow```
22 | * For Windows: Open CMD, then type ```pip install Pillow```
23 |
24 |
25 | ---
26 | ## Demo
27 |
28 |
29 |
30 |
31 | ### Show some ❤️ by starring the repository!
32 |
33 |
34 |
--------------------------------------------------------------------------------
/demo.PNG:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insanecodes/Icon-Maker-GUI/36a305cd4e6b4f790868c3518ad0e65ec9325788/demo.PNG
--------------------------------------------------------------------------------
/icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insanecodes/Icon-Maker-GUI/36a305cd4e6b4f790868c3518ad0e65ec9325788/icon.ico
--------------------------------------------------------------------------------
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/insanecodes/Icon-Maker-GUI/36a305cd4e6b4f790868c3518ad0e65ec9325788/icon.png
--------------------------------------------------------------------------------
/main.py:
--------------------------------------------------------------------------------
1 | # Import Libraries
2 | from tkinter import *
3 | import tkinter.filedialog
4 | from tkinter import messagebox
5 | import os
6 | from PIL import Image
7 |
8 |
9 | class converter_window:
10 | def __init__(self, root):
11 | self.root = root
12 | # Change the title
13 | self.root.title("Icon Maker")
14 | # Change the window size
15 | self.root.geometry("500x240")
16 | # no resize for both directions
17 | self.root.resizable(False, False)
18 | # Change icon
19 | self.root.iconbitmap('icon.ico')
20 |
21 | # set gui widgets
22 | self.title = Label(self.root, text="Icon Maker", font=(
23 | 'helvetica', 24), fg="blue")
24 | self.title.place(x=160, y=4)
25 |
26 | Label(self.root, text="Select Input Image", font=(
27 | 'helvetica', 11), fg="blue").place(x=43, y=70)
28 |
29 | self.input = Entry(self.root, width=42, font=(
30 | 'helvetica', 10), bg="lightgrey", relief=GROOVE, borderwidth=2)
31 | self.input.place(x=45, y=100, height=33)
32 |
33 | btn_convert = Button(self.root, relief=FLAT, text="Choose File", font=(
34 | 'helvetica', 10, 'bold'), bg="blue", fg="white", command=self.openFile)
35 | btn_convert.place(x=355, y=100, width=95, height=32)
36 |
37 | btn_convert = Button(self.root, relief=FLAT, text="Convert to ICO", font=(
38 | 'helvetica', 12, 'bold'), bg="blue", fg="white", command=self.convertToICO)
39 | btn_convert.place(x=182, y=163, width=130, height=40)
40 |
41 | def openFile(self):
42 | '''function for dialog box to select input image file'''
43 | global img, import_file_path
44 | import_file_path = tkinter.filedialog.askopenfilename(defaultextension=".png", filetypes=[(
45 | "PNG files", "*.png"), ("jpeg files", "*.jpg"), ("All Files", "*.*")])
46 | self.input.delete(0, END)
47 | self.input.insert(0, import_file_path)
48 | img = Image.open(import_file_path)
49 |
50 | def convertToICO(self):
51 | '''function for converting input image to ico format'''
52 | global img, import_file_path
53 | print(os.path.exists(import_file_path))
54 | if os.path.exists(import_file_path) == True:
55 | if os.path.isfile(import_file_path) == True:
56 | export_file_path = tkinter.filedialog.asksaveasfilename(
57 | defaultextension='.ico', filetypes=[("ico files", "*.ico")])
58 | img.save(export_file_path)
59 | messagebox.showinfo("Success", "File converted and saved")
60 | else:
61 | messagebox.showerror("Failed", "Image file's path does not exists")
62 |
63 |
64 | if __name__ == "__main__":
65 | img = ""
66 | import_file_path = ""
67 | root = Tk()
68 | obj = converter_window(root)
69 | root.mainloop()
70 |
--------------------------------------------------------------------------------