import base64
import os
from PIL import Image
import io
ASSETS_DIR = r"c:\Users\Carlos\dev\almeira-web\assets_generados"
PUBLIC_DIR = r"c:\Users\Carlos\dev\almeira-web\dripzone-app\public"
# Rutas de las imagenes maestras
SPLASH_IMG_PATH = os.path.join(ASSETS_DIR, "dripzone_splash_clean_1787718656035.jpg")
ICON_IMG_PATH = os.path.join(ASSETS_DIR, "dripzone_app_icon_1787718672979.jpg")
splash_img = Image.open(SPLASH_IMG_PATH)
icon_img = Image.open(ICON_IMG_PATH)
def to_base64(img, format="PNG"):
buffer = io.BytesIO()
img.save(buffer, format=format, quality=100)
return f"data:image/{format.lower()};base64," + base64.b64encode(buffer.getvalue()).decode('utf-8')
print("-> Generando SVGs 100% identicos y exactos a las imagenes maestras...")
# 1. dripzone_logo_app_icon.svg (El logo cuadrado 1:1 identico de la app)
w, h = icon_img.size
icon_b64 = to_base64(icon_img, "PNG")
svg_icon = f''''''
with open(os.path.join(ASSETS_DIR, "dripzone_logo_app_icon.svg"), "w", encoding="utf-8") as f:
f.write(svg_icon)
with open(os.path.join(PUBLIC_DIR, "dripzone_logo_app_icon.svg"), "w", encoding="utf-8") as f:
f.write(svg_icon)
print(" [OK] dripzone_logo_app_icon.svg")
# 2. dripzone_emblem.svg (El emblema 'D' Sneaker extraido exactamente del Splash)
# Crop exacto del D-Emblem
sw, sh = splash_img.size
emblem_img = splash_img.crop((125, 230, 645, 750)).resize((600, 600), Image.Resampling.LANCZOS)
emblem_b64 = to_base64(emblem_img, "PNG")
svg_emblem = f''''''
with open(os.path.join(ASSETS_DIR, "dripzone_emblem.svg"), "w", encoding="utf-8") as f:
f.write(svg_emblem)
with open(os.path.join(PUBLIC_DIR, "dripzone_emblem.svg"), "w", encoding="utf-8") as f:
f.write(svg_emblem)
print(" [OK] dripzone_emblem.svg")
# 3. dripzone_wordmark.svg (El texto DRIPZONE + ROPA URBANA Y ZAPATILLAS DEPORTIVAS recortado exacto)
wordmark_img = splash_img.crop((80, 750, 688, 980))
ww, wh = wordmark_img.size
wordmark_b64 = to_base64(wordmark_img, "PNG")
svg_wordmark = f''''''
with open(os.path.join(ASSETS_DIR, "dripzone_wordmark.svg"), "w", encoding="utf-8") as f:
f.write(svg_wordmark)
with open(os.path.join(PUBLIC_DIR, "dripzone_wordmark.svg"), "w", encoding="utf-8") as f:
f.write(svg_wordmark)
print(" [OK] dripzone_wordmark.svg")
# 4. dripzone_splash_screen.svg (El Splash Screen vertical completo en SVG)
splash_b64 = to_base64(splash_img, "PNG")
svg_splash = f''''''
with open(os.path.join(ASSETS_DIR, "dripzone_splash_screen.svg"), "w", encoding="utf-8") as f:
f.write(svg_splash)
with open(os.path.join(PUBLIC_DIR, "dripzone_splash_screen.svg"), "w", encoding="utf-8") as f:
f.write(svg_splash)
print(" [OK] dripzone_splash_screen.svg")
# 5. dripzone_logo_horizontal.svg (Composicion horizontal con emblema D a la izquierda y Wordmark a la derecha)
canvas_w = 1200
canvas_h = 420
canvas_img = Image.new("RGBA", (canvas_w, canvas_h), (9, 9, 11, 255))
# Pegar emblema escalado a la izquierda
emb_resized = emblem_img.resize((380, 380), Image.Resampling.LANCZOS)
canvas_img.paste(emb_resized, (30, 20), emb_resized if emb_resized.mode == 'RGBA' else None)
# Pegar wordmark escalado a la derecha
wm_resized = wordmark_img.resize((720, 280), Image.Resampling.LANCZOS)
canvas_img.paste(wm_resized, (440, 70), wm_resized if wm_resized.mode == 'RGBA' else None)
horizontal_b64 = to_base64(canvas_img, "PNG")
svg_horizontal = f''''''
with open(os.path.join(ASSETS_DIR, "dripzone_logo_horizontal.svg"), "w", encoding="utf-8") as f:
f.write(svg_horizontal)
with open(os.path.join(PUBLIC_DIR, "dripzone_logo_horizontal.svg"), "w", encoding="utf-8") as f:
f.write(svg_horizontal)
print(" [OK] dripzone_logo_horizontal.svg")
print("\n[EXITO COMPLETO] Todos los archivos SVG quedaron 100% identicos y fieles a las imagenes maestras.")