from PIL import Image, ImageDraw, ImageFont
# Create a black background image
img_size = (300, 300)
background = "black"
image = Image.new("RGB", img_size, background)
# Get a drawing context
draw = ImageDraw.Draw(image)
# Define the text and font
text = "gubbyiscool2"
try:
\# Use a common font like Arial if available
font = ImageFont.truetype("arial.ttf", 36)
except IOError:
\# Fallback to a default font
font = ImageFont.load_default()
# Get the size of the text
text_bbox = draw.textbbox((0, 0), text, font=font)
text_width = text_bbox[2] - text_bbox[0]
text_height = text_bbox[3] - text_bbox[1]
# Calculate text position to center it
text_x = (img_size[0] - text_width) / 2
text_y = (img_size[1] - text_height) / 2
# Draw the white text on the image
draw.text((text_x, text_y), text, font=font, fill="white")
# Save the final image
image.save("gubbyiscool2_circle.png")
print("Image saved as gubbyiscool2_circle.png")