-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_logo.py
More file actions
86 lines (68 loc) · 2.86 KB
/
create_logo.py
File metadata and controls
86 lines (68 loc) · 2.86 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
from PIL import Image, ImageDraw, ImageFont, ImageFilter
import math
def create_gradient_circle(draw, center, radius, color1, color2):
"""Draws a radial gradient circle."""
for i in range(radius, 0, -1):
# Interpolate color
ratio = 1 - (i / radius)
r = int(color1[0] * (1 - ratio) + color2[0] * ratio)
g = int(color1[1] * (1 - ratio) + color2[1] * ratio)
b = int(color1[2] * (1 - ratio) + color2[2] * ratio)
box = [center[0] - i, center[1] - i, center[0] + i, center[1] + i]
draw.ellipse(box, fill=(r, g, b))
def create_simple_infinity_logo():
# High resolution for quality downscaling
size = (1024, 1024)
# Transparent background
img = Image.new('RGBA', size, (0, 0, 0, 0))
draw = ImageDraw.Draw(img)
center = (512, 512)
radius = 480
# Drop Shadow (Offset dark circle)
shadow_offset = 20
shadow_box = [center[0] - radius + shadow_offset, center[1] - radius + shadow_offset,
center[0] + radius + shadow_offset, center[1] + radius + shadow_offset]
draw.ellipse(shadow_box, fill=(0, 0, 0, 100))
# Main Circle Gradient (Red to Dark Red)
create_gradient_circle(draw, center, radius, (220, 20, 60), (139, 0, 0))
# The Symbol: Infinity Loop
infinity_color = (255, 255, 255, 255)
# Reduced scale and shifted up
scale = 300
shift_y = -50
# Thick line simulation
thickness = 45
for i in range(0, 360 * 2, 1):
t = math.radians(i)
denom = 1 + math.sin(t)**2
x = center[0] + (scale * math.cos(t) / denom)
y = center[1] + (scale * math.sin(t) * math.cos(t) / denom) + shift_y
# Draw circle at point for thickness
box = [x - thickness, y - thickness, x + thickness, y + thickness]
draw.ellipse(box, fill=infinity_color)
# Add Text "Loader"
try:
# Try to load a nice font
font_size = 120
try:
font = ImageFont.truetype("arialbd.ttf", font_size)
except:
font = ImageFont.truetype("arial.ttf", font_size)
except:
font = ImageFont.load_default()
text = "Loader"
# Calculate text position to center it
text_bbox = draw.textbbox((0, 0), text, font=font)
text_width = text_bbox[2] - text_bbox[0]
text_height = text_bbox[3] - text_bbox[1]
text_x = center[0] - (text_width / 2)
text_y = center[1] + 175 # Moved slightly down as requested
draw.text((text_x, text_y), text, font=font, fill=(255, 255, 255, 255))
# Final Resize and Save
img.save("logo.ico", format="ICO", sizes=[(256, 256), (128, 128), (64, 64), (48, 48), (32, 32), (16, 16)])
print("✅ Generated high-quality logo.ico with multiple sizes")
if __name__ == "__main__":
try:
create_simple_infinity_logo()
except Exception as e:
print(f"Error: {e}")