120 lines
4.7 KiB
Python
120 lines
4.7 KiB
Python
import os
|
|
from PIL import Image, ImageDraw, ImageFont, ImageFilter
|
|
|
|
def create_icon():
|
|
src_icon_path = 'assets/icon/icon.png'
|
|
dest_icon_path = 'store_listing/graficos/icono_512.png'
|
|
|
|
im = Image.open(src_icon_path).convert('RGBA')
|
|
# Resize with high quality Lanczos filter
|
|
im_512 = im.resize((512, 512), Image.Resampling.LANCZOS)
|
|
|
|
# Google Play Store expects a 512x512 icon without transparent margins
|
|
# We create a solid background if transparent, or save as RGB
|
|
bg = Image.new('RGB', (512, 512), (13, 45, 107)) # #0D2D6B brand primary
|
|
bg.paste(im_512, (0, 0), im_512)
|
|
bg.save(dest_icon_path, 'PNG', optimize=True)
|
|
print(f"Icon created: {dest_icon_path} (512x512)")
|
|
|
|
def create_feature_graphic():
|
|
dest_path = 'store_listing/graficos/grafico_destacado_1024x500.png'
|
|
w, h = 1024, 500
|
|
|
|
# Gradient background: Navy Blue (#0A1E3C to #0D2D6B)
|
|
img = Image.new('RGB', (w, h), (10, 30, 60))
|
|
draw = ImageDraw.Draw(img)
|
|
|
|
for y in range(h):
|
|
# Subtle vertical gradient
|
|
r = int(10 + (13 - 10) * (y / h))
|
|
g = int(30 + (45 - 30) * (y / h))
|
|
b = int(60 + (107 - 60) * (y / h))
|
|
draw.line([(0, y), (w, y)], fill=(r, g, b))
|
|
|
|
# Add subtle geometric / modern tech diagonal accent lines
|
|
accent_color = (25, 118, 210, 40) # #1976D2
|
|
overlay = Image.new('RGBA', (w, h), (0, 0, 0, 0))
|
|
overlay_draw = ImageDraw.Draw(overlay)
|
|
|
|
overlay_draw.polygon([(650, 0), (1024, 0), (1024, 500), (450, 500)], fill=(20, 60, 120, 45))
|
|
overlay_draw.polygon([(780, 0), (1024, 0), (1024, 500), (620, 500)], fill=(25, 118, 210, 35))
|
|
overlay_draw.line([(450, 500), (650, 0)], fill=(25, 118, 210, 100), width=2)
|
|
|
|
img = Image.alpha_composite(img.convert('RGBA'), overlay).convert('RGB')
|
|
draw = ImageDraw.Draw(img)
|
|
|
|
# Load and place app icon on the left
|
|
icon_src = Image.open('assets/icon/icon.png').convert('RGBA')
|
|
icon_size = 280
|
|
icon_resized = icon_src.resize((icon_size, icon_size), Image.Resampling.LANCZOS)
|
|
|
|
# Icon card with rounded corners and drop shadow
|
|
mask = Image.new('L', (icon_size, icon_size), 0)
|
|
mask_draw = ImageDraw.Draw(mask)
|
|
mask_draw.rounded_rectangle([(0, 0), (icon_size, icon_size)], radius=56, fill=255)
|
|
|
|
icon_x = 75
|
|
icon_y = (h - icon_size) // 2
|
|
|
|
# Shadow
|
|
shadow = Image.new('RGBA', (w, h), (0, 0, 0, 0))
|
|
s_draw = ImageDraw.Draw(shadow)
|
|
s_draw.rounded_rectangle(
|
|
[(icon_x - 6, icon_y + 12), (icon_x + icon_size + 6, icon_y + icon_size + 24)],
|
|
radius=60,
|
|
fill=(0, 0, 0, 140)
|
|
)
|
|
shadow = shadow.filter(ImageFilter.GaussianBlur(16))
|
|
img = Image.alpha_composite(img.convert('RGBA'), shadow).convert('RGB')
|
|
|
|
# Paste rounded icon
|
|
img.paste(icon_resized, (icon_x, icon_y), mask)
|
|
|
|
# Draw Text Typography
|
|
draw = ImageDraw.Draw(img)
|
|
|
|
font_path_bold = '/usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Bold.ttf'
|
|
font_path_reg = '/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf'
|
|
if not os.path.exists(font_path_bold):
|
|
font_path_bold = '/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf'
|
|
if not os.path.exists(font_path_reg):
|
|
font_path_reg = '/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf'
|
|
|
|
title_font = ImageFont.truetype(font_path_bold, 50)
|
|
badge_font = ImageFont.truetype(font_path_bold, 18)
|
|
sub_font = ImageFont.truetype(font_path_reg, 22)
|
|
pill_font = ImageFont.truetype(font_path_bold, 15)
|
|
|
|
text_x = icon_x + icon_size + 60
|
|
|
|
# Badge pill
|
|
badge_y = icon_y + 15
|
|
draw.rounded_rectangle([(text_x, badge_y), (text_x + 190, badge_y + 32)], radius=16, fill=(25, 118, 210))
|
|
draw.text((text_x + 14, badge_y + 5), "SIGMAC · CLOUD", font=badge_font, fill=(255, 255, 255))
|
|
|
|
# Main Title
|
|
title_y = badge_y + 44
|
|
draw.text((text_x, title_y), "AGENTE VENTAS", font=title_font, fill=(255, 255, 255))
|
|
|
|
# Subtitle
|
|
sub_y = title_y + 64
|
|
draw.text((text_x, sub_y), "Gestión de Pedidos, Rutas y Preventa en Campo", font=sub_font, fill=(170, 187, 204))
|
|
|
|
# Feature pills (Offline First, Firma Digital, Lector Barcode)
|
|
pills = ["⚡ 100% Fuera de Línea", "✍ Firma Digital", "📦 Stock en Tiempo Real"]
|
|
pill_x = text_x
|
|
pill_y = sub_y + 45
|
|
for p in pills:
|
|
bbox = draw.textbbox((0, 0), p, font=pill_font)
|
|
pw = bbox[2] - bbox[0] + 24
|
|
draw.rounded_rectangle([(pill_x, pill_y), (pill_x + pw, pill_y + 30)], radius=12, fill=(22, 53, 88), outline=(30, 64, 112))
|
|
draw.text((pill_x + 12, pill_y + 6), p, font=pill_font, fill=(220, 235, 255))
|
|
pill_x += pw + 12
|
|
|
|
img.save(dest_path, 'PNG', optimize=True)
|
|
print(f"Feature graphic created: {dest_path} (1024x500)")
|
|
|
|
if __name__ == '__main__':
|
|
create_icon()
|
|
create_feature_graphic()
|