Ecco due possibili vie per ottenere l’immagine desiderata:
1) Usare DALL·E (prompt engineering)
Se hai accesso all’API di OpenAI per generare immagini, puoi passare questo prompt a DALL·E:
{
"model": "dall-e-3",
"prompt": "Create a 7000×4000 px abstract background that looks like frosted (smerigliato) glass – heavily blurred. In the exact center (both vertically and horizontally), overlay two lines of text in Aptos font: first line “competenze trasversali”, one empty line, then “soft skills”. The text should also be blurred to match the background style but slightly darker so it remains legible, and occupy about 75% of the image area.",
"size": "7000x4000",
"n": 1,
"response_format": "url"
}
DALL·E interpreterà “frosted glass”, applicherà un blur consistente e posizionerà il testo esattamente al centro, con le caratteristiche richieste.
2) Generare l’immagine in locale con Python + Pillow
Di seguito un esempio di script Python che:
- Crea uno sfondo sfocato “frosted” a partire da un semplice gradiente o rumore.
- Disegna il testo in Aptos (devi scaricare il file .ttf) al centro.
- Applica un leggero ulteriore blur sul testo per farlo “fondere” con lo sfondo.
from PIL import Image, ImageDraw, ImageFont, ImageFilter
import numpy as np
# 1) Parametri
W, H = 7000, 4000
TEXT = "competenze trasversali\n\nsoft skills"
FONT_PATH = "Aptos-Regular.ttf" # scarica il .ttf da una fonte affidabile
FONT_SIZE = int(min(W, H) * 0.75 / 2)
TEXT_COLOR = (50, 50, 50) # leggermente più scuro
# 2) Crea sfondo “frosted glass” (rumore + blur)
# Puoi sostituire il noise con un gradiente se preferisci
noise = np.random.randint(150, 255, (H, W, 3), dtype='uint8')
bg = Image.fromarray(noise)
bg = bg.filter(ImageFilter.GaussianBlur(radius=50))
# 3) Prepara il layer di testo
txt_layer = Image.new("RGBA", (W, H), (255, 255, 255, 0))
draw = ImageDraw.Draw(txt_layer)
font = ImageFont.truetype(FONT_PATH, FONT_SIZE)
# 4) Calcola posizione del testo (centrato)
w_txt, h_txt = draw.multiline_textsize(TEXT, font=font, spacing=FONT_SIZE*0.5)
x = (W - w_txt) // 2
y = (H - h_txt) // 2
# 5) Disegna il testo
draw.multiline_text(
(x, y),
TEXT,
font=font,
fill=TEXT_COLOR+(200,), # alpha per la visibilità
spacing=FONT_SIZE*0.5,
align="center"
)
# 6) Applica blur anche al layer di testo
txt_layer = txt_layer.filter(ImageFilter.GaussianBlur(radius=10))
# 7) Composita e salva
out = Image.alpha_composite(bg.convert("RGBA"), txt_layer)
out.save("frosted_soft_skills.png")
print("Immagine salvata come frosted_soft_skills.png")
‐‐‐
➡️ Passaggi chiave
- usa
GaussianBlur per sfocare sfondo e testo
- calcola dimensione font in modo che occupi ~75% dell’area
- centra il testo con
multiline_textsize
Scegli il metodo più comodo per te! Se hai bisogno di ulteriori dettagli o aggiustamenti, fammi sapere 😊