-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_icon.py
More file actions
45 lines (37 loc) · 1.73 KB
/
Copy pathcreate_icon.py
File metadata and controls
45 lines (37 loc) · 1.73 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
from PIL import Image, ImageDraw, ImageFont
# Create ASCII art as image
ascii_art = """
██████████ ████████████ ██████████
████ ████ ████ ████ ████
████ ████ ████ ████
████ ████ ████████████ ████ ██████
████ ████ ████ ████ ████
████ ████ ████ ████ ████
████ ████ ████████████ ████ ████
██████████ ████████████ ██████████
"""
# Create image with red text on black background
img_size = 256
img = Image.new('RGB', (img_size, img_size), color='black')
draw = ImageDraw.Draw(img)
# Try to use a monospace font, fallback to default
try:
font = ImageFont.truetype("consola.ttf", 18)
except:
font = ImageFont.load_default()
# Draw the ASCII art
lines = ascii_art.strip().split('\n')
y_offset = 20
for line in lines:
draw.text((5, y_offset), line, fill='red', font=font)
y_offset += 25
# Save as PNG first
img.save('d:/Coding/TruTopsDWGtoGEO/d2g_ascii_icon.png')
# Create ICO with multiple sizes
sizes = [(256, 256), (128, 128), (64, 64), (48, 48), (32, 32), (16, 16)]
icons = []
for size in sizes:
resized = img.resize(size, Image.Resampling.LANCZOS)
icons.append(resized)
icons[0].save('d:/Coding/TruTopsDWGtoGEO/d2g_icon.ico', format='ICO', sizes=[(s[0], s[1]) for s in sizes])
print("Created d2g_icon.ico successfully!")