Friday, 24 April 2020

Show Text with PIL

This post demonstrates a way to display text, including Chinese, using PIL (Python Image Library).
  1. Python Image Library (PIL) will be called. This can be installed by:
    # apt-get install python-pil
  2. TrueType or OpenType fonts of the system are called. Check your system fonts in:
    /usr/share/fonts
    You are required to give the exact filename (e.g. XXX.ttf) for the fonts to be used. However, the paths for locating the font files are not necessary.
  3. Beautiful Chinese fonts are available from Google Noto project:
    https://www.google.com/get/noto/help/cjk/

Source Code





t1.png
The image obtained

No comments:

Post a Comment