Commit 0b2adb20 by BellCodeEditor

save project

parent 1d7aee71
Showing with 9 additions and 2 deletions
j.png

218 KB

import wordcloud
from PIL import Image
import numpy
with open("python二级考试大纲.txt","r",encoding="utf-8")as f:
a=f.read()
w=wordcloud.WordCloud(background_color="blue",font_path="SimHei.ttf")
w.generate("a")
img=Image.open("bell.png")
data=numpy.array(img)
img_color=wordcloud.ImageColorGenerator(data)
w=wordcloud.WordCloud(background_color="blue",font_path="SimHei.ttf",mask=data,color_func=img_color)
w.generate(a)
w.to_file("j.png")
\ 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