Untitled
unknown
plain_text
a year ago
857 B
2
Indexable
from PIL import Image, ImageDraw, ImageFont # Define image dimensions width = 800 height = 600 # Create a new image with white background image = Image.new("RGB", (width, height), "white") draw = ImageDraw.Draw(image) # Define font and font size font = ImageFont.truetype("arial.ttf", 20) # Define positions for each word positions = { "dairying_word": (100, 100), "market_gardening_word": (100, 200), "ranching_word": (100, 300), "plantation_word": (100, 400) } # Draw each word on the image for word, elements in zip(["dairying_word", "market_gardening_word", "ranching_word", "plantation_word"], [dairying_word, market_gardening_word, ranching_word, plantation_word]): draw.text(positions[word], "\n".join(elements), font=font, fill="black") # Save the image image.save("agriculture_words_image.png")
Editor is loading...
Leave a Comment