from PIL import Image, ImageDraw import os # Buat folder output jika belum ada output_dir = "/mnt/kimi/output/icons" os.makedirs(output_dir, exist_ok=True) # ================= 1. LOCATION PIN (Merah) ================= def create_location_pin(): size = 128 img = Image.new('RGBA', (size, size), (0, 0, 0, 0)) draw = ImageDraw.Draw(img) # Warna red = (255, 50, 50, 255) dark_red = (180, 0, 0, 255) white = (255, 255, 255, 255) # Posisi center cx, cy = size // 2, size // 2 + 5 # Sedikit turun karena bentuk pin # Bayangan/Outline (bentuk pin) # Pin terdiri dari lingkaran atas + segitiga bawah pin_radius = 35 # Gambar bayangan dulu (offset) shadow_offset = 3 draw.ellipse([cx - pin_radius + shadow_offset, cy - pin_radius + shadow_offset, cx + pin_radius + shadow_offset, cy + pin_radius + shadow_offset], fill=(0, 0, 0, 100)) # Lingkaran utama (atas pin) draw.ellipse([cx - pin_radius, cy - pin_radius, cx + pin_radius, cy + pin_radius], fill=red, outline=dark_red, width=3) # Segitiga bawah (pointer pin) triangle_top = cy + pin_radius - 10 triangle_h = 40 points = [ (cx, triangle_top + triangle_h), # Ujung bawah (pointy) (cx - 20, triangle_top), # Kiri (cx + 20, triangle_top) # Kanan ] draw.polygon(points, fill=red, outline=dark_red) # Titik putih di tengah (center dot) dot_r = 12 draw.ellipse([cx - dot_r, cy - dot_r, cx + dot_r, cy + dot_r], fill=white) # Highlight kecil di kiri atas lingkaran (efek glossy) highlight_r = 8 draw.ellipse([cx - 15, cy - 15, cx - 15 + highlight_r*2, cy - 15 + highlight_r*2], fill=(255, 255, 255, 150)) return img # ================= 2. CALENDAR (Gold/Kuning) ================= def create_calendar(): size = 128 img = Image.new('RGBA', (size, size), (0, 0, 0, 0)) draw = ImageDraw.Draw(img) # Warna Gold gold = (255, 215, 0, 255) dark_gold = (184, 134, 11, 255) white = (255, 255, 255, 255) # Ukuran kalender margin = 15 box_left = margin box_top = margin + 10 # Turun sedikit untuk ring hooks box_right = size - margin box_bottom = size - margin # Hooks (ring pengikat kalender di atas) hook_w = 8 hook_h = 12 gap = 15 cx = size // 2 # Left hook hook_left_x = cx - gap draw.rounded_rectangle([hook_left_x - hook_w//2, box_top - hook_h, hook_left_x + hook_w//2, box_top], radius=3, fill=dark_gold, outline=dark_gold) # Right hook hook_right_x = cx + gap draw.rounded_rectangle([hook_right_x - hook_w//2, box_top - hook_h, hook_right_x + hook_w//2, box_top], radius=3, fill=dark_gold, outline=dark_gold) # Body kalender (box utama dengan rounded corners) corner_r = 10 draw.rounded_rectangle([box_left, box_top, box_right, box_bottom], radius=corner_r, fill=gold, outline=dark_gold, width=3) # Header kalender (bagian atas yang lebih gelap) header_h = 35 draw.rounded_rectangle([box_left + 3, box_top + 3, box_right - 3, box_top + header_h], radius=corner_r-2, fill=dark_gold) # Garis-garis simulasi tanggal (3 garis horizontal putih) line_y_start = box_top + header_h + 20 line_w = box_right - box_left - 30 line_x = box_left + 15 line_h = 6 for i in range(3): y = line_y_start + (i * 15) draw.rounded_rectangle([line_x, y, line_x + line_w, y + line_h], radius=2, fill=white) return img # ================= 3. CLOCK (Gold/Kuning) ================= def create_clock(): size = 128 img = Image.new('RGBA', (size, size), (0, 0, 0, 0)) draw = ImageDraw.Draw(img) # Warna gold = (255, 215, 0, 255) dark_gold = (184, 134, 11, 255) white = (255, 255, 255, 255) cx, cy = size // 2, size // 2 radius = 50 # Bayangan luar (glow effect) draw.ellipse([cx - radius - 3, cy - radius - 3, cx + radius + 3, cy + radius + 3], fill=(0, 0, 0, 50)) # Body jam (lingkaran gold) draw.ellipse([cx - radius, cy - radius, cx + radius, cy + radius], fill=gold, outline=dark_gold, width=4) # Inner circle (border dalam) inner_r = radius - 8 draw.ellipse([cx - inner_r, cy - inner_r, cx + inner_r, cy + inner_r], outline=dark_gold, width=2) # Ticks/jam (4 titik cardinal: 12, 3, 6, 9) tick_len = 10 tick_color = dark_gold # 12 o'clock draw.line([(cx, cy - inner_r + 5), (cx, cy - inner_r + 5 + tick_len)], fill=tick_color, width=3) # 3 o'clock draw.line([(cx + inner_r - 5 - tick_len, cy), (cx + inner_r - 5, cy)], fill=tick_color, width=3) # 6 o'clock draw.line([(cx, cy + inner_r - 5 - tick_len), (cx, cy + inner_r - 5)], fill=tick_color, width=3) # 9 o'clock draw.line([(cx - inner_r + 5, cy), (cx - inner_r + 5 + tick_len, cy)], fill=tick_color, width=3) # Jarum jam (hour hand) - pendek, ke arah 10 hour_angle = -60 # 10 o'clock hour_len = 25 hour_x = cx + int(hour_len * 0.5) # Koreksi posisi hour_y = cy - int(hour_len * 0.7) draw.line([(cx, cy), (hour_x, hour_y)], fill=white, width=5) draw.ellipse([hour_x - 3, hour_y - 3, hour_x + 3, hour_y + 3], fill=white) # Jarum menit (minute hand) - panjang, ke arah 2 min_angle = 60 # 2 o'clock min_len = 35 min_x = cx + int(min_len * 0.8) min_y = cy + int(min_len * 0.4) draw.line([(cx, cy), (min_x, min_y)], fill=(255, 255, 220, 255), width=4) # Center dot (titik tengah jam) center_r = 6 draw.ellipse([cx - center_r, cy - center_r, cx + center_r, cy + center_r], fill=dark_gold, outline=white, width=2) # Highlight glossy di kiri atas jam highlight_x = cx - radius + 15 highlight_y = cy - radius + 15 draw.ellipse([highlight_x, highlight_y, highlight_x + 12, highlight_y + 12], fill=(255, 255, 255, 180)) return img # ================= GENERATE ALL ================= print("Generating icon PNG files...") # 1. Location loc_img = create_location_pin() loc_img.save(f"{output_dir}/location.png", "PNG") print(f"āœ… location.png saved ({loc_img.size[0]}x{loc_img.size[1]})") # 2. Calendar cal_img = create_calendar() cal_img.save(f"{output_dir}/calendar.png", "PNG") print(f"āœ… calendar.png saved ({cal_img.size[0]}x{cal_img.size[1]})") # 3. Clock clk_img = create_clock() clk_img.save(f"{output_dir}/clock.png", "PNG") print(f"āœ… clock.png saved ({clk_img.size[0]}x{clk_img.size[1]})") print(f"\nšŸ“ All icons saved to: {output_dir}") print("Ready to use with your PHP script!")