-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_icon.py
More file actions
192 lines (165 loc) · 5.79 KB
/
create_icon.py
File metadata and controls
192 lines (165 loc) · 5.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
"""
Create a microphone icon for HotMic
"""
from PIL import Image, ImageDraw
import os
def create_microphone_icon():
"""Create a simple microphone icon"""
# Create image with multiple sizes for .ico file
sizes = [(256, 256), (128, 128), (64, 64), (48, 48), (32, 32), (16, 16)]
images = []
for size in sizes:
# Create new image with transparent background
img = Image.new('RGBA', size, (0, 0, 0, 0))
draw = ImageDraw.Draw(img)
# Calculate dimensions based on size
width, height = size
scale = width / 256.0
# Colors
mic_color = (220, 50, 50) # Red
stand_color = (100, 100, 100) # Gray
# Microphone body (rounded rectangle)
mic_width = int(80 * scale)
mic_height = int(120 * scale)
mic_x = (width - mic_width) // 2
mic_y = int(40 * scale)
# Draw microphone capsule
draw.ellipse(
[mic_x, mic_y, mic_x + mic_width, mic_y + mic_width],
fill=mic_color,
outline=mic_color
)
draw.rectangle(
[mic_x, mic_y + mic_width//2, mic_x + mic_width, mic_y + mic_height],
fill=mic_color,
outline=mic_color
)
draw.ellipse(
[mic_x, mic_y + mic_height - mic_width//2,
mic_x + mic_width, mic_y + mic_height + mic_width//2],
fill=mic_color,
outline=mic_color
)
# Draw microphone grill lines
grill_color = (255, 255, 255, 180)
grill_lines = 5
for i in range(grill_lines):
y = mic_y + int((20 + i * 15) * scale)
draw.line(
[mic_x + int(15 * scale), y,
mic_x + mic_width - int(15 * scale), y],
fill=grill_color,
width=max(1, int(2 * scale))
)
# Draw stand/arc
stand_thickness = max(2, int(8 * scale))
stand_y = mic_y + mic_height + int(10 * scale)
# Arc under microphone
arc_rect = [
mic_x - int(10 * scale), stand_y,
mic_x + mic_width + int(10 * scale), stand_y + int(40 * scale)
]
draw.arc(arc_rect, 0, 180, fill=stand_color, width=stand_thickness)
# Base line
base_y = stand_y + int(40 * scale)
draw.line(
[mic_x - int(20 * scale), base_y,
mic_x + mic_width + int(20 * scale), base_y],
fill=stand_color,
width=stand_thickness
)
# Center line
center_x = width // 2
draw.line(
[center_x, stand_y, center_x, base_y],
fill=stand_color,
width=stand_thickness
)
images.append(img)
# Save as .ico file
icon_path = os.path.join(os.path.dirname(__file__), 'hotmic.ico')
images[0].save(
icon_path,
format='ICO',
sizes=[(img.width, img.height) for img in images],
append_images=images[1:]
)
print(f"Icon created: {icon_path}")
return icon_path
def create_alternative_icon():
"""Create an alternative design with sound waves"""
sizes = [(256, 256), (128, 128), (64, 64), (48, 48), (32, 32), (16, 16)]
images = []
for size in sizes:
img = Image.new('RGBA', size, (0, 0, 0, 0))
draw = ImageDraw.Draw(img)
width, height = size
scale = width / 256.0
center_x, center_y = width // 2, height // 2
# Draw sound waves
wave_color = (100, 150, 255, 100) # Light blue
for i in range(3):
radius = int((50 + i * 30) * scale)
thickness = max(1, int(4 * scale))
draw.arc(
[center_x - radius, center_y - radius,
center_x + radius, center_y + radius],
-45, 45,
fill=wave_color,
width=thickness
)
draw.arc(
[center_x - radius, center_y - radius,
center_x + radius, center_y + radius],
135, 225,
fill=wave_color,
width=thickness
)
# Draw microphone in center
mic_size = int(60 * scale)
mic_color = (220, 50, 50) # Red
# Mic body
draw.ellipse(
[center_x - mic_size//2, center_y - mic_size//2,
center_x + mic_size//2, center_y + mic_size//2],
fill=mic_color,
outline=(150, 30, 30)
)
# Mic grill
grill_color = (255, 255, 255, 180)
grill_size = int(mic_size * 0.6)
for i in range(3):
y = center_y - grill_size//2 + int(i * grill_size / 3)
draw.line(
[center_x - grill_size//2, y,
center_x + grill_size//2, y],
fill=grill_color,
width=max(1, int(2 * scale))
)
images.append(img)
# Save as .ico file
icon_path = os.path.join(os.path.dirname(__file__), 'hotmic_alt.ico')
images[0].save(
icon_path,
format='ICO',
sizes=[(img.width, img.height) for img in images],
append_images=images[1:]
)
print(f"Alternative icon created: {icon_path}")
return icon_path
if __name__ == '__main__':
try:
print("Creating HotMic icons...")
icon1 = create_microphone_icon()
icon2 = create_alternative_icon()
print("\nIcons created successfully!")
print(f" 1. hotmic.ico - Classic microphone design")
print(f" 2. hotmic_alt.ico - Microphone with sound waves")
print("\nYou can now use these icons for shortcuts.")
except ImportError:
print("Error: Pillow (PIL) library not found!")
print("Install it with: pip install Pillow")
except Exception as e:
print(f"Error creating icons: {e}")
import traceback
traceback.print_exc()