Created
December 2, 2017 18:19
-
-
Save niazangels/8478caa11740da6dfcbc2b0519ca330b to your computer and use it in GitHub Desktop.
How to render malayalam text as images
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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