125 lines
5.5 KiB
Python
125 lines
5.5 KiB
Python
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'''<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {w} {h}" width="100%" height="100%">
|
|
<defs>
|
|
<clipPath id="roundedCorner">
|
|
<rect x="0" y="0" width="{w}" height="{h}" rx="{int(w*0.18)}" ry="{int(h*0.18)}" />
|
|
</clipPath>
|
|
</defs>
|
|
<!-- Background Glow & Shadow -->
|
|
<rect x="0" y="0" width="{w}" height="{h}" rx="{int(w*0.18)}" fill="#09090b"/>
|
|
<!-- Imagen Exacta en Alta Resolucion Vectorial -->
|
|
<image href="{icon_b64}" x="0" y="0" width="{w}" height="{h}" preserveAspectRatio="xMidYMid meet" clip-path="url(#roundedCorner)" />
|
|
</svg>'''
|
|
|
|
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'''<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 600 600" width="100%" height="100%">
|
|
<defs>
|
|
<radialGradient id="emblemGlow" cx="50%" cy="50%" r="50%">
|
|
<stop offset="0%" stop-color="#9333ea" stop-opacity="0.3"/>
|
|
<stop offset="100%" stop-color="#000000" stop-opacity="0"/>
|
|
</radialGradient>
|
|
</defs>
|
|
<rect width="600" height="600" fill="url(#emblemGlow)" rx="120"/>
|
|
<image href="{emblem_b64}" x="0" y="0" width="600" height="600" preserveAspectRatio="xMidYMid meet" />
|
|
</svg>'''
|
|
|
|
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'''<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {ww} {wh}" width="100%" height="100%">
|
|
<image href="{wordmark_b64}" x="0" y="0" width="{ww}" height="{wh}" preserveAspectRatio="xMidYMid meet" />
|
|
</svg>'''
|
|
|
|
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'''<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {sw} {sh}" width="100%" height="100%">
|
|
<image href="{splash_b64}" x="0" y="0" width="{sw}" height="{sh}" preserveAspectRatio="xMidYMid slice" />
|
|
</svg>'''
|
|
|
|
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'''<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 {canvas_w} {canvas_h}" width="100%" height="100%">
|
|
<rect width="{canvas_w}" height="{canvas_h}" fill="#09090b" rx="24"/>
|
|
<image href="{horizontal_b64}" x="0" y="0" width="{canvas_w}" height="{canvas_h}" preserveAspectRatio="xMidYMid meet" />
|
|
</svg>'''
|
|
|
|
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.")
|