File size: 663 Bytes
b752d16
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from PIL import Image, ImageDraw, ImageFont
import os

def create_sample_image(text, filename):
    # Create a white image
    img = Image.new('RGB', (800, 400), color=(255, 255, 255))
    d = ImageDraw.Draw(img)
    
    # Try to load a default font
    try:
        # On macOS, this might work
        font = ImageFont.truetype("/System/Library/Fonts/Supplemental/Arial.ttf", 40)
    except:
        font = ImageFont.load_default()
        
    d.text((100, 150), text, fill=(0, 0, 0), font=font)
    img.save(filename)
    print(f"Created {filename}")

if __name__ == "__main__":
    create_sample_image("DeepSeek-OCR-2 test. Hello World!", "sample_test.png")