region:us
pip install Pillow
from PIL import Image, ImageDraw, ImageFont

def text_to_image(text, output_path='output_image.png', font_size=20):
    # Create a blank image with white background
    image = Image.new('RGB', (500, 100), color='white')
    draw = ImageDraw.Draw(image)

    # Choose a font
    font = ImageFont.load_default()

    # Set text color
    text_color = 'black'

    # Set starting position for the text
    x, y = 10, 10

    # Draw the text on the image
    draw.text((x, y), text, font=font, fill=text_color)

    # Save the image
    image.save(output_path)

if __name__ == "__main__":
    # Example usage
    input_text = "Hello, Hugging Face!"
    text_to_image(input_text)
