-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from Iulujianjie/master
Hello,I want to join in this program.
- Loading branch information
Showing
7 changed files
with
17 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
from PIL import Image, ImageDraw, ImageFont | ||
|
||
im = Image.open('image.jpg') | ||
w,h = im.size | ||
font_size = h/4 | ||
|
||
draw = ImageDraw.Draw(im) | ||
fnt = ImageFont.truetype ("Arial.ttf",font_size) | ||
|
||
text_w,text_h = draw.textsize("8",font=fnt) # 给定文字message,返回所占像素(width,height) | ||
|
||
draw.text((w-text_w,0), "8", fill=(255,0,0), font=fnt)#图片宽度减去字体宽度、要写的字符、颜色、字体 | ||
|
||
|
||
im.save('image_1.jpg') | ||
|
||
#reference http://www.cnblogs.com/wei-li/archive/2012/04/19/2456725.html |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.