"""Generate SaiCore brand icons - modern, clean design with 'S' lettermark.""" from PIL import Image, ImageDraw, ImageFont import math def create_icon(size, filename, big=False): """Create a SaiCore icon with gradient background and S lettermark.""" img = Image.new('RGBA', (size, size), (0, 0, 0, 0)) draw = ImageDraw.Draw(img) # Gradient background circle - indigo to violet cx, cy = size // 2, size // 2 radius = int(size * 0.46) for y in range(size): for x in range(size): dx = x - cx dy = y - cy dist = math.sqrt(dx*dx + dy*dy) if dist <= radius: # Gradient from top-left (indigo) to bottom-right (violet) t = (dx + dy) / (2 * radius + 1) t = max(0, min(1, t)) r = int(79 + (139 - 79) * t) g = int(70 + (92 - 70) * t) b = int(200 + (246 - 200) * t) # Anti-alias edge if dist > radius - 2: alpha = int(255 * (radius - dist) / 2) alpha = max(0, min(255, alpha)) img.putpixel((x, y), (r, g, b, alpha)) else: img.putpixel((x, y), (r, g, b, 255)) # Draw "S" lettermark draw = ImageDraw.Draw(img) # Try to use a bold font font_size = int(size * 0.55) font = None for font_name in ['C:/Windows/Fonts/segoeuib.ttf', 'C:/Windows/Fonts/arialbd.ttf', 'C:/Windows/Fonts/arial.ttf']: try: font = ImageFont.truetype(font_name, font_size) break except: continue if font is None: font = ImageFont.load_default() # Get text bounding box text = "S" bbox = draw.textbbox((0, 0), text, font=font) tw = bbox[2] - bbox[0] th = bbox[3] - bbox[1] tx = cx - tw // 2 - bbox[0] ty = cy - th // 2 - bbox[1] # Draw white S with subtle shadow # Shadow for ox, oy in [(1, 1), (2, 2)]: draw.text((tx + ox, ty + oy), text, fill=(0, 0, 0, 60), font=font) # Main text draw.text((tx, ty), text, fill=(255, 255, 255, 255), font=font) img.save(filename, 'PNG') print(f"Created: {filename} ({size}x{size})") def create_document_icon(size, filename): """Create a document icon with SaiCore branding.""" img = Image.new('RGBA', (size, size), (0, 0, 0, 0)) draw = ImageDraw.Draw(img) # Document shape - white rounded rectangle margin = int(size * 0.1) doc_left = margin doc_top = margin doc_right = size - margin doc_bottom = size - margin corner = int(size * 0.08) # Folded corner fold = int(size * 0.2) # Draw document body draw.polygon([ (doc_left, doc_top), (doc_right - fold, doc_top), (doc_right, doc_top + fold), (doc_right, doc_bottom), (doc_left, doc_bottom) ], fill=(255, 255, 255, 255), outline=(200, 200, 200, 255), width=1) # Fold triangle draw.polygon([ (doc_right - fold, doc_top), (doc_right, doc_top + fold), (doc_right - fold, doc_top + fold) ], fill=(220, 220, 220, 255)) # Draw colored bar at top (indigo) bar_height = int(size * 0.12) draw.rectangle( [doc_left + 2, doc_top + 2, doc_right - 1, doc_top + bar_height], fill=(99, 102, 241, 255) ) # Draw "S" on the bar font_size = int(bar_height * 0.8) font = None for font_name in ['C:/Windows/Fonts/segoeuib.ttf', 'C:/Windows/Fonts/arialbd.ttf']: try: font = ImageFont.truetype(font_name, font_size) break except: continue if font is None: font = ImageFont.load_default() text = "S" bbox = draw.textbbox((0, 0), text, font=font) tw = bbox[2] - bbox[0] th = bbox[3] - bbox[1] tx = doc_left + (doc_right - doc_left - tw) // 2 - bbox[0] ty = doc_top + (bar_height - th) // 2 - bbox[1] + 2 draw.text((tx, ty), text, fill=(255, 255, 255, 255), font=font) # Draw lines representing text line_y = doc_top + bar_height + int(size * 0.08) line_spacing = int(size * 0.06) line_left = doc_left + int(size * 0.08) line_right = doc_right - int(size * 0.08) for i in range(5): y = line_y + i * line_spacing w = line_right if i < 4 else line_right - int(size * 0.15) draw.line([(line_left, y), (w, y)], fill=(180, 180, 180, 255), width=max(1, int(size * 0.015))) img.save(filename, 'PNG') print(f"Created: {filename} ({size}x{size})") # Generate all icons create_icon(256, 'resources/images/SaiCore.png') create_icon(512, 'resources/images/bigSaiCore.png', big=True) create_document_icon(256, 'resources/images/saicore-document.png') print("All icons generated!")