DigitalDB / create_logo.py
Mr-Thop's picture
Change Py files
8f6c61f
Raw
History Blame Contribute Delete
2.32 kB
from PIL import Image, ImageDraw, ImageFont
import os
def create_seerbharat_logo():
# Create a 128x128 image with transparent background
size = 128
img = Image.new('RGBA', (size, size), (0, 0, 0, 0))
draw = ImageDraw.Draw(img)
# Define colors
green = (16, 185, 129) # emerald-500
dark_green = (4, 120, 87) # emerald-700
white = (255, 255, 255)
# Draw a circular background
circle_margin = 10
draw.ellipse([circle_margin, circle_margin, size-circle_margin, size-circle_margin],
fill=green, outline=dark_green, width=3)
# Draw a simple leaf shape in the center
center_x, center_y = size // 2, size // 2
# Leaf body (ellipse)
leaf_width, leaf_height = 50, 70
left = center_x - leaf_width // 2
top = center_y - leaf_height // 2 - 5
right = left + leaf_width
bottom = top + leaf_height
draw.ellipse([left, top, right, bottom], fill=white)
# Leaf stem
stem_width = 3
stem_height = 15
stem_left = center_x - stem_width // 2
stem_top = center_y + leaf_height // 2 - 10
draw.rectangle([stem_left, stem_top, stem_left + stem_width, stem_top + stem_height], fill=white)
# Leaf vein (simple line)
vein_start_x = center_x
vein_start_y = top + 10
vein_end_x = center_x
vein_end_y = bottom - 15
draw.line([vein_start_x, vein_start_y, vein_end_x, vein_end_y], fill=dark_green, width=2)
# Side veins
for i in range(3):
offset_y = top + 20 + i * 15
# Left side vein
draw.line([center_x - 2, offset_y, center_x - 15, offset_y + 8], fill=dark_green, width=1)
# Right side vein
draw.line([center_x + 2, offset_y, center_x + 15, offset_y + 8], fill=dark_green, width=1)
# Save as PNG
os.makedirs('public/images', exist_ok=True)
img.save('public/images/logo.png', 'PNG')
print("Logo created successfully: public/images/logo.png")
# Also create a smaller 32x32 version for navbar
small_logo = img.resize((32, 32), Image.Resampling.LANCZOS)
small_logo.save('public/images/logo-32.png', 'PNG')
print("Small logo created: public/images/logo-32.png")
if __name__ == "__main__":
create_seerbharat_logo()