Skip to content

Instantly share code, notes, and snippets.

@niazangels
Created December 2, 2017 18:19
Show Gist options
  • Save niazangels/8478caa11740da6dfcbc2b0519ca330b to your computer and use it in GitHub Desktop.
Save niazangels/8478caa11740da6dfcbc2b0519ca330b to your computer and use it in GitHub Desktop.
How to render malayalam text as images
from PIL import Image, ImageDraw, ImageFont
import matplotlib.pyplot as plt
import numpy as np
image = Image.new('RGB', (700, 40))
# Make sure the location to the font is correct
draw.text((40,5), 'നമ്മുടെ മലയാളം അടിപൊളിയായി ഇമേജിൽ വരുന്നു', font=ImageFont.truetype('./Manjari-Bold.ttf', 25))
plt.imshow(np.asarray(image))
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment