Repository navigation
Expand file tree
/
Copy pathmake_og.py
More file actions
79 lines (67 loc) · 2.68 KB
/
Copy pathmake_og.py
File metadata and controls
79 lines (67 loc) · 2.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Genera og-image.png (1200x630) branded para Be Sign.
from PIL import Image, ImageDraw, ImageFont
import math
W, H = 1200, 630
img = Image.new("RGB", (W, H), "#0E1424")
d = ImageDraw.Draw(img)
# Fondo: degradado diagonal navy -> royal
top = (14, 20, 36) # #0E1424
bot = (4, 35, 110) # hacia royal
for y in range(H):
t = y / H
r = int(top[0] + (bot[0]-top[0])*t)
g = int(top[1] + (bot[1]-top[1])*t)
b = int(top[2] + (bot[2]-top[2])*t)
d.line([(0, y), (W, y)], fill=(r, g, b))
# Glow cian arriba-derecha
glow = Image.new("RGBA", (W, H), (0,0,0,0))
gd = ImageDraw.Draw(glow)
for rad in range(380, 0, -4):
a = int(70 * (1 - rad/380))
gd.ellipse([W-260-rad, -160-rad, W-260+rad, -160+rad], fill=(22, 192, 230, a))
img.paste(glow, (0,0), glow)
def font(sz, bold=True):
paths = [
"C:/Windows/Fonts/georgiab.ttf" if bold else "C:/Windows/Fonts/georgia.ttf",
]
for p in paths:
try:
return ImageFont.truetype(p, sz)
except Exception:
continue
return ImageFont.load_default()
def font_sans(sz):
for p in ["C:/Windows/Fonts/segoeui.ttf", "C:/Windows/Fonts/arial.ttf"]:
try:
return ImageFont.truetype(p, sz)
except Exception:
continue
return ImageFont.load_default()
PAD = 80
# Eyebrow
d.text((PAD, 96), "FIRMA ELECTRÓNICA · BEGROUP", font=font_sans(24), fill=(91, 214, 240))
# Titular serif
d.text((PAD, 150), "Firma documentos", font=font(76), fill="white")
d.text((PAD, 238), "con validez legal,", font=font(76), fill="white")
d.text((PAD, 326), "en minutos.", font=font(76), fill=(91, 214, 240))
# Subcopy
d.text((PAD, 446), "El firmador electrónico que verifica quién firma.",
font=font_sans(30), fill=(207, 213, 238))
d.text((PAD, 488), "Biometría · cifrado · firma masiva.",
font=font_sans(30), fill=(160, 170, 205))
# Logo mark (firma) abajo-izquierda
mx, my = PAD, 552
d.rounded_rectangle([mx, my, mx+48, my+48], radius=13, fill=(255,255,255,25), outline=(91,214,240), width=2)
# trazo de firma dentro del cuadro
sig = [(mx+9, my+30), (mx+16, my+15), (mx+22, my+34), (mx+29, my+12), (mx+36, my+30), (mx+40, my+24)]
d.line(sig, fill=(91,214,240), width=3, joint="curve")
d.line([mx+8, my+38, mx+40, my+38], fill=(16,185,129), width=3)
d.text((mx+64, my+4), "Be Sign", font=font(36), fill="white")
# URL chip abajo-derecha
chip = "socket-studio.com/demo-aplicaciones/be-sign"
cf = font_sans(22)
tw = d.textlength(chip, font=cf)
d.rounded_rectangle([W-PAD-tw-40, 564, W-PAD, 606], radius=21, outline=(120, 132, 175), width=2)
d.text((W-PAD-tw-20, 575), chip, font=cf, fill=(207, 213, 238))
img.save("public/og-image.png", "PNG")
print("og-image.png generado", img.size)