-
-
未解决 [求助]为什么图片上没有显示汉字啊
-
发表于: 2020-11-7 13:22 1294
-
我想在图片左上角显示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()
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()
[招生]系统0day安全班,企业级设备固件漏洞挖掘,Linux平台漏洞挖掘!
赞赏
他的文章
- [求助]这个是什么壳 1547
- [求助]早期音频处理AU的1.5开放了sdk吗 1570
- 请教一个C++的编译错误 4350
- 有谁对电驴的协议有了解 3321
- [求助]vbs如何发送()键 3431
看原图
赞赏
雪币:
留言: