[Answer]-ImageFont from font data or URL

0👍

For people interested in the solution, refer to this post.

Edit : It has been merged to master now, enjoy !

👤Mibou

1👍

Example can be found into the test in Pillow repository:

from PIL import ImageFont
from io import BytesIO

def _font_as_bytes():
    with open(FONT_PATH, 'rb') as f:
        font_bytes = BytesIO(f.read())
    return font_bytes

ImageFont.truetype(_font_as_bytes(), FONT_SIZE)

And see also: How do I open an image from the internet in PIL?

Leave a comment