File size: 1,509 Bytes
20444bb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os
from PIL import Image, ImageDraw, ImageFont

def create_placeholder_images():
    # Create images directory if it doesn't exist
    os.makedirs("images", exist_ok=True)
    
    # Define characters and emotions
    characters = ["echidna", "platypus", "kangaroo"]
    emotions = ["neutral", "happy", "sad", "surprised","angry"]
    
    # Create a 400x400 image for each character/emotion combination
    for character in characters:
        for emotion in emotions:
            # Create new image with white background
            img = Image.new('RGB', (400, 400), 'white')
            draw = ImageDraw.Draw(img)
            
            # Add text to image
            text = f"{character}\n{emotion}"
            
            # Try to use a system font, fallback to default
            try:
                font = ImageFont.truetype("Arial", 40)
            except:
                font = ImageFont.load_default()
                
            # Center the text
            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 the text
            draw.text((x, y), text, fill='black', font=font, align='center')
            
            # Save the image
            filename = f"images/{character}_{emotion}.png"
            img.save(filename)

if __name__ == "__main__":
    create_placeholder_images()