A close up of a washing machine and a small white object

Generation Data
Records
Prompts
Copy
from PIL import Image
,
ImageDraw
,
ImageFont
# Define the dimensions of the image
width = 600
height = 800
# Define the background color of the image
background_color = (255
,
255
,
255)
# Define the font size and font family
font_size = 40
font_family = "arial
.
ttf"
# Define the text to be displayed on the image
text = "Aviso Legal"
# Define the color of the text
text_color = (0
,
0
,
0)
# Create a new image with the specified dimensions and background color
image = Image
.
new("RGB"
,
(width
,
height)
,
background_color)
# Create a new drawing object for the image
draw = ImageDraw
.
Draw(image)
# Load the font
font = ImageFont
.
truetype(font_family
,
font_size)
# Calculate the size of the text
text_width
,
text_height = draw
.
textsize(text
,
font=font)
# Calculate the position of the text
x = (width - text_width) / 2
y = (height - text_height) / 2
# Draw the text on the image
draw
.
text((x
,
y)
,
text
,
fill=text_color
,
font=font)
# Save the image to a file
image
.
save("aviso_legal
.
png")
INFO
0 comment
0
0
0