from PIL import Image, ImageDraw, ImageFont
# Crear una nueva imagen con fondo blanco
width, height = 400, 200
image = Image.new('RGB', (width, height), 'white')
draw = ImageDraw.Draw(image)
# Rellenar el fondo con un color
background_color = (220, 220, 220)
draw.rectangle([(0, 0), (width, height)], fill=background_color)
# Escribir el texto "ChatGPT" en el centro de la imagen
text = "ChatGPT"
text_color = (0, 0, 0) # Color negro
font = ImageFont.truetype('Arial.ttf', 40) # Ruta a una fuente de texto TrueType
text_width, text_height = draw.textsize(text, font=font)
text_position = ((width - text_width) // 2, (height - text_height) // 2)
draw.text(text_position, text, fill=text_color, font=font)
# Guardar la imagen en un archivo
image.save('chatgpt_image.png')