79805293

Date: 2025-10-30 23:08:27
Score: 2
Natty:
Report link
from PIL import Image, ImageDraw, ImageFont
import random

# Escala y dimensiones
scale = 10  # 1 cm = 10 px
width_px = 183 * scale
height_px = 35 * scale

# Crear imagen de fondo blanco
visual = Image.new("RGB", (width_px, height_px), (255, 255, 255))
draw = ImageDraw.Draw(visual)

# Fuente para etiquetas
try:
    font = ImageFont.truetype("arial.ttf", 15)
except:
    font = ImageFont.load_default()

# Datos de fotos (tipo, tamaño cm, posición cm)
photos = [
    ("G1",16,22,2,2),("G2",14,20,20,2),("G3",18,18,38,2),("G4",16,22,56,2),
    ("G5",14,20,74,2),("G6",16,22,92,2),("G7",18,18,110,2),("G8",16,22,128,2),
    ("G9",14,20,146,2),("G10",16,22,164,2),
    ("G11",14,20,2,25),("G12",16,22,20,25),("G13",18,18,38,25),("G14",16,22,56,25),
    ("G15",14,20,74,25),("G16",16,22,92,25),("G17",18,18,110,25),("G18",16,22,128,25),
    ("G19",14,20,146,25),("G20",16,22,164,25),
    ("M1",10,13,5,15),("M2",10,13,20,15),("M3",10,13,35,12),("M4",10,13,50,15),
    ("M5",10,13,65,12),("M6",10,13,80,15),("M7",10,13,95,12),("M8",10,13,110,15),
    ("M9",10,13,125,12),("M10",10,13,140,15),("M11",10,13,155,12),("M12",10,13,170,15),
    ("M13",10,13,5,28),("M14",10,13,20,28),("M15",10,13,35,28),("M16",10,13,50,28),
    ("M17",10,13,65,28),("M18",10,13,80,28),("M19",10,13,95,28),("M20",10,13,110,28),
    ("M21",10,13,125,28),("M22",10,13,140,28),("M23",10,13,155,28),
    ("P1",7,10,8,7),("P2",7,10,23,7),("P3",7,10,38,7),("P4",7,10,53,7),("P5",7,10,68,7),
    ("P6",7,10,83,7),("P7",7,10,98,7),("P8",7,10,113,7),("P9",7,10,128,7),("P10",7,10,143,7),
    ("P11",7,10,158,7),("P12",7,10,173,7),("P13",7,10,8,22),("P14",7,10,23,22),("P15",7,10,38,22),
    ("P16",7,10,53,22),("P17",7,10,68,22),("P18",7,10,83,22),("P19",7,10,98,22),("P20",7,10,113,22),
    ("P21",7,10,128,22),("P22",7,10,143,22),("P23",7,10,158,22),("P24",7,10,173,22),
    ("P25",7,10,8,33),("P26",7,10,23,33),("P27",7,10,38,33),("P28",7,10,53,33),("P29",7,10,68,33),
    ("P30",7,10,83,33),("P31",7,10,98,33),
    ("Mi1",5,5,12,12),("Mi2",5,5,27,12),("Mi3",5,5,42,12),("Mi4",5,5,57,12),("Mi5",5,5,72,12),
    ("Mi6",5,5,87,12),("Mi7",5,5,102,12),("Mi8",5,5,117,12),("Mi9",5,5,132,12),("Mi10",5,5,147,12)
]

# Función para color aleatorio
def random_color():
    return tuple(random.randint(100, 255) for _ in range(3))

# Dibujar fotos con color y etiqueta
for code, w_cm, h_cm, x_cm, y_cm in photos:
    x0 = x_cm * scale
    y0 = y_cm * scale
    x1 = x0 + w_cm * scale
    y1 = y0 + h_cm * scale
    fill_color = random_color()
    draw.rectangle([x0, y0, x1, y1], outline=(0,0,0), width=2, fill=fill_color)
    text_w, text_h = draw.textsize(code, font=font)
    draw.text((x0+(x1-x0-text_w)/2, y0+(y1-y0-text_h)/2), code, fill=(0,0,0), font=font)

# Guardar imagen final
visual.save("collage_visual.png")
print("Collage visual generado: collage_visual.png")
Reasons:
  • Blacklisted phrase (2): Crear
  • Long answer (-1):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: Keilyn