|
|
import os |
|
|
from PIL import Image, ImageDraw, ImageFont |
|
|
|
|
|
def create_placeholder_images(): |
|
|
|
|
|
os.makedirs("images", exist_ok=True) |
|
|
|
|
|
|
|
|
characters = ["echidna", "platypus", "kangaroo"] |
|
|
emotions = ["neutral", "happy", "sad", "surprised","angry"] |
|
|
|
|
|
|
|
|
for character in characters: |
|
|
for emotion in emotions: |
|
|
|
|
|
img = Image.new('RGB', (400, 400), 'white') |
|
|
draw = ImageDraw.Draw(img) |
|
|
|
|
|
|
|
|
text = f"{character}\n{emotion}" |
|
|
|
|
|
|
|
|
try: |
|
|
font = ImageFont.truetype("Arial", 40) |
|
|
except: |
|
|
font = ImageFont.load_default() |
|
|
|
|
|
|
|
|
bbox = draw.textbbox((0, 0), text, font=font) |
|
|
text_width = bbox[2] - bbox[0] |
|
|
text_height = bbox[3] - bbox[1] |
|
|
x = (400 - text_width) / 2 |
|
|
y = (400 - text_height) / 2 |
|
|
|
|
|
|
|
|
draw.text((x, y), text, fill='black', font=font, align='center') |
|
|
|
|
|
|
|
|
filename = f"images/{character}_{emotion}.png" |
|
|
img.save(filename) |
|
|
|
|
|
if __name__ == "__main__": |
|
|
create_placeholder_images() |
|
|
|