forked from Show-Me-the-Code/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c39bfa5
commit b440d19
Showing
2 changed files
with
17 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,17 @@ | ||
print "hello python" | ||
from PIL import Image,ImageDraw,ImageFont | ||
|
||
def addNum(filePath): | ||
img = Image.open(filePath) | ||
size = img.size | ||
fontSize = size[1] / 4 | ||
draw = ImageDraw.Draw(img) | ||
|
||
ttFont = ImageFont.truetype("symbol.ttf", fontSize) | ||
draw.text((size[0]-fontSize, 0), "6",(256,0,0), font=ttFont) | ||
del draw | ||
img.save('./result.jpg') | ||
img.show() | ||
|
||
|
||
if __name__ == '__main__': | ||
addNum("image.jpg") |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.