Commit 6279ad75 by BellCodeEditor

save project

parent 6e73a1ff
Showing with 8 additions and 9 deletions
This diff is collapsed. Click to expand it.
import wordcloud import wordcloud
from PIL import Image from PIL import Image
import numpy import numpy
f=open('python二级考试大纲.txt','r',encoding='utf-8') with open('python二级考试大纲.txt','r',encoding='utf-8')as f:
n=f.read() n=f.read()
i=Image.open('1.png') i=Image.open('1.jpg')
i_c=numpy.array(i)
d=wordcloud.ImageColorGenerator(i_c)
print(i) print(i)
w=wordcloud.WordCloud(background_color='lightgreen',font_path='STXINGKA.TTF') w=wordcloud.WordCloud(background_color='white',font_path='STXINGKA.TTF',mask=i_c,color_func=d)
w.generate(n) w.generate(n)
w.to_file('6x2.png') w.to_file('1.png')
f.close()
v=numpy.array(i)
print(v)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment