程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python workbook, a small program every day, question 0000

編輯:Python

This paper is finally updated at 1163 Days ago, , The information may have developed or changed .

requirement

  Put your QQ Head portrait ( Or micro blog avatar ) Add a red number to the top right corner , It is similar to the prompt effect of the amount of unread information on wechat . Similar to the effect in the picture

Code

from PIL import Image, ImageDraw, ImageFont
iconPath=r"F:\ Study \ Mobile Internet APP\APP Icon \bf181022.png"
icon=Image.open(iconPath,'r')
image=Image.new("RGBA",(icon.size[0]+100,icon.size[1]+100))
image.paste(icon,(0,100))
draw=ImageDraw.Draw(image)
draw.ellipse([icon.size[0]-100,5,icon.size[0]+100,205],"red")
userFont=ImageFont.truetype('simsun.ttc',100)
draw.text([icon.size[0]-50,55],u'99','white',font=userFont)
image.save(r"temp/out.png","PNG")

Post Views: 366


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved