Created
June 18, 2020 01:50
-
-
Save drhanlau/61f6123ff810a317f794577cb82bfdc2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
img = Image.open('mutton.jpg') | |
font = ImageFont.truetype('/Library/Fonts/Impact.ttf', 100) | |
draw = ImageDraw.Draw(img) | |
def draw_text(x, y, text): | |
draw.text((x-2, y-2), text,(0,0,0),font=font) | |
draw.text((x+2, y-2), text,(0,0,0),font=font) | |
draw.text((x+2, y+2), text,(0,0,0),font=font) | |
draw.text((x-2, y+2), text,(0,0,0),font=font) | |
draw.text((x, y), text, (255,255,255), font=font) | |
draw_text(200,50,"XUE HUA PIAO PIAO") | |
draw_text(200,900, "BEI FENG XIAO XIAO") | |
img.save("out.jpg") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment