File size: 626 Bytes
ce847d4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
"""Create test image with text 'ONE OCR DZIAŁA!' for OCR testing."""
from PIL import Image, ImageDraw, ImageFont

# Create white image
img = Image.new("RGB", (600, 150), color="white")
draw = ImageDraw.Draw(img)

# Try to use a good font, fallback to default
try:
    font = ImageFont.truetype("arial.ttf", 48)
except OSError:
    try:
        font = ImageFont.truetype("C:/Windows/Fonts/arial.ttf", 48)
    except OSError:
        font = ImageFont.load_default()

# Draw black text
draw.text((30, 40), "ONE OCR DZIALA!", fill="black", font=font)

img.save("image.png")
print("Created image.png with text 'ONE OCR DZIALA!'")