Türkçe Karakter

 avatar
unknown
python
a year ago
694 B
10
Indexable
import cv2
import numpy as np
from PIL import Image, ImageDraw, ImageFont

# Boş bir resim oluştur
image = np.zeros((500, 1000, 3), dtype=np.uint8)

# Pillow kullanarak resim üzerinde yazı yaz
pil_image = Image.fromarray(image)
draw = ImageDraw.Draw(pil_image)
font = ImageFont.truetype("arial.ttf", 20)

# Türkçe karakterleri içeren metin
text = "Merhaba, Türkçe karakterler: ç, ı, ğ, ü, ş, ö"

# Metni çiz
draw.text((50, 50), text, font=font, fill=(255, 255, 255, 255))

# Pillow resmi tekrar numpy array'e çevir
image = np.array(pil_image)

# OpenCV ile resmi göster
cv2.imshow("Türkçe Karakterler", image)
cv2.waitKey(0)
cv2.destroyAllWindows()
Editor is loading...
Leave a Comment