ŵ[Ƶ̳]Ƶ̳[Ƶ̳]VBSƵ̳
[ļƷ]Ƭ[ļƷ]ߵ
б

[] PythonΪʲôͼƬûʾְ

ͼƬϽʾ88888888нʲôûаʲôԭ
  1. import datetime
  2. import re
  3. #from PIL import Image
  4. from PIL import Image, ImageDraw, ImageFont
  5. image = Image.new(mode='RGB',size=(640, 480),color=(0,0,0))
  6. weiqi = datetime.datetime.now().strftime("%Y%m%d") + '.png'
  7. # print (datetime.datetime.now().strftime("%Y%m%d"))
  8. # print (weiqi)
  9. img=Image.open('yi001.png')
  10. width = img.size[0]
  11. height = img.size[1]
  12. print (width)
  13. print (height)
  14. img = img.resize((int(width*0.8), int(height*0.8)), Image.ANTIALIAS)
  15. image.paste(img, (120,40))
  16. draw = ImageDraw.Draw(img)
  17. font = ImageFont.truetype(font='simfang.ttf', size=10)
  18. draw.text(xy=(0,0), text='88888888', fill=(255, 255, 255), font=font)
  19. image.save(weiqi, 'png')
  20. image.close()
ƴ
ղ

б