Skip to content

Instantly share code, notes, and snippets.

View streamride's full-sized avatar

Andrey Zakharov streamride

  • Russia
View GitHub Profile
@streamride
streamride / text_to_image.py
Created April 13, 2019 09:45 — forked from pbojinov/text_to_image.py
Using Python's PIL to render text to image - http://effbot.org/imagingbook/overview.htm
import os
from PIL import Image, ImageDraw, ImageFont
# make sure you have the fonts locally in a fonts/ directory
georgia_bold = 'fonts/georgia_bold.ttf'
georgia_bold_italic = 'fonts/georgia_bold_italic.ttf'
# W, H = (1280, 720) # image size
W, H = (720, 405) # image size
txt = 'Hello Petar this is my test image' # text to render