Untitled

 avatar
unknown
plain_text
2 years ago
744 B
3
Indexable
from PIL import Image, ImageDraw, ImageFont

# Create a blank image with a white background
width, height = 800, 1200
background_color = (255, 255, 255)
image = Image.new("RGB", (width, height), background_color)
draw = ImageDraw.Draw(image)

# Add a title
title_text = "Your Book Title"
title_font = ImageFont.load_default()
title_position = (50, 50)
title_color = (0, 0, 0)
draw.text(title_position, title_text, font=title_font, fill=title_color)

# Add an author
author_text = "Author Name"
author_font = ImageFont.load_default()
author_position = (50, 100)
author_color = (0, 0, 0)
draw.text(author_position, author_text, font=author_font, fill=author_color)

# Save the image to a file
image.save("book_cover.png")
Editor is loading...
Leave a Comment