ÎÒÏëÔÚͼƬ×óÉϽÇÏÔʾ88888888£¬ÔËÐнá¹ûʲô¶¼Ã»Óа¡£¬ÊÇʲôÔÒò£¿- import datetime
- import re
- #from PIL import Image
- from PIL import Image, ImageDraw, ImageFont
- image = Image.new(mode='RGB',size=(640, 480),color=(0,0,0))
-
- weiqi = datetime.datetime.now().strftime("%Y%m%d") + '.png'
- # print (datetime.datetime.now().strftime("%Y%m%d"))
- # print (weiqi)
-
- img=Image.open('yi001.png')
- width = img.size[0]
- height = img.size[1]
- print (width)
- print (height)
- img = img.resize((int(width*0.8), int(height*0.8)), Image.ANTIALIAS)
- image.paste(img, (120,40))
-
- draw = ImageDraw.Draw(img)
-
- font = ImageFont.truetype(font='simfang.ttf', size=10)
- draw.text(xy=(0,0), text='88888888', fill=(255, 255, 255), font=font)
-
- image.save(weiqi, 'png')
- image.close()
¸´ÖÆ´úÂë
|