from PIL import Image, ImageDraw, ImageFont # Taille de la couverture width, height = 800, 1200 # Couleurs pink_light = (255, 182, 193) # rose clair pink_dark = (255, 105, 180) # rose plus foncĂ© white = (255, 255, 255) gold = (255, 223, 0) # CrĂ©ation du fond dĂ©gradĂ© cover = Image.new("RGB", (width, height), pink_light) draw = ImageDraw.Draw(cover) # DĂ©gradĂ© simple vertical for i in range(height): r = int(pink_light[0] + (pink_dark[0] - pink_light[0]) * (i / height)) g = int(pink_light[1] + (pink_dark[1] - pink_light[1]) * (i / height)) b = int(pink_light[2] + (pink_dark[2] - pink_light[2]) * (i / height)) draw.line([(0, i), (width, i)], fill=(r, g, b)) # Ajouter le titre title_text = "Mon Journal Magique đ" try: font = ImageFont.truetype("arial.ttf", 80) # ou une autre police except: font = ImageFont.load_default() text_width, text_height = draw.textsize(title_text, font=font) draw.text(((width - text_width) / 2, height / 4), title_text, fill=white, font=font) # Ajouter quelques Ă©toiles/cĆurs dĂ©coratifs import random for _ in range(50): x, y = random.randint(0, width), random.randint(0, height) size = random.randint(5, 20) draw.text((x, y), "â", fill=gold, font=font) for _ in range(30): x, y = random.randint(0, width), random.randint(0, height) size = random.randint(10, 30) draw.text((x, y), "đ", fill=white, font=font) # Sauvegarder lâimage cover.save("page_couverture_journal.png") print("Page de couverture gĂ©nĂ©rĂ©e !") See more