Skip to content

Instantly share code, notes, and snippets.

@rpappalax
Created June 25, 2014 20:54
Show Gist options
  • Save rpappalax/3a60c4af171e35a8c7e9 to your computer and use it in GitHub Desktop.
Save rpappalax/3a60c4af171e35a8c7e9 to your computer and use it in GitHub Desktop.
Python Pillow library for generating images
import PIL
from PIL import ImageFont
from PIL import Image
from PIL import ImageDraw
# font = ImageFont.truetype("Arial-Bold.ttf",14)
font = ImageFont.truetype("ArialUnicode.ttf",34)
img=Image.new("RGBA", (500,250),(255,255,255))
draw = ImageDraw.Draw(img)
draw.text((0, 0),"This is a test",(0,0,0) ,font=font)
draw = ImageDraw.Draw(img)
img.save("a_test.png")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment