Commit 5728f37a by BellCodeEditor

save project

parent 1b51b1af
Showing with 9 additions and 1 deletions

76.6 KB | W: | H:

511 KB | W: | H:

asdfghjkl.png
asdfghjkl.png
asdfghjkl.png
asdfghjkl.png
  • 2-up
  • Swipe
  • Onion skin
import wordcloud
from PIL import Image
import numpy
with open('python二级考试大纲.txt',encoding='utf-8')as f:
a=f.read()
w = wordcloud.WordCloud(background_color="white",font_path='SimHei.ttf')
image=Image.open('s.png')
data = numpy.array(image)
image_color = wordcloud.ImageColorGenerator(data)
w = wordcloud.WordCloud(background_color="white",font_path='SimHei.ttf',mask=data,color_func = image_color)
w.generate(a)
w.to_file('asdfghjkl.png')
\ No newline at end of file
s.png

260 KB

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