Commit efffff98 by BellCodeEditor

save project

parent df29b8b0
Showing with 9 additions and 3 deletions
import wordcloud
from PIL import Image
import numpy
import jieba
with open('鸡你太美.txt',encoding='utf-8') as f:
text = f.read()
t1=jieba.lcut(text)
text=" ".join(t1)
img=Image.open('0.jpg')
data=numpy.array(img)
img_colors=wordcloud.ImageColorGenerator(data)
with open('鸡你太美.txt',encoding='utf-8') as f:
text = f.read()
stop=["eh","uh","up","oh"]
w=wordcloud.WordCloud(background_color="white",width=2000,height=1400,
font_path='Simhei.ttf',mask=data,color_func=img_colors)
font_path='Simhei.ttf',mask=data,color_func=img_colors,stopwords=stop,max_font_size=80)
w.generate(text)
w.to_file("mycloud.png")
\ No newline at end of file

159 KB | W: | H:

131 KB | W: | H:

mycloud.png
mycloud.png
mycloud.png
mycloud.png
  • 2-up
  • Swipe
  • Onion skin
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