Skip to content

Instantly share code, notes, and snippets.

@j2labs
Created December 17, 2009 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save j2labs/258902 to your computer and use it in GitHub Desktop.
Save j2labs/258902 to your computer and use it in GitHub Desktop.
from arabic_rtlize.process import rtlize
from PIL import Image, ImageFont, ImageDraw
real_urdu = "اس صفحہ کو ترامیم کیلیۓ نـیـم محفوظ کر دیا گیا ہے اور صارف کو اندراج کر کے داخل نوشتہ ہونا لازم ہے۔"
urdu = rtlize(unicode(real_urdu, 'UTF-8'))
img = Image.new("L", (1000,200))
draw = ImageDraw.Draw(img)
f = ImageFont.truetype('/Users/jd/Desktop/urduimg/geeza.ttf', 20)
draw.text((10,40), urdu, fill=255, font=f)
img.save('/Users/jd/Desktop/pil.png', optimize=1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment