Commit b29c00ce by BellCodeEditor

save project

parent 9a04dddb
File added
import wordcloud
from PIL import Image
import numpy as np
with open("python二级考试大纲.txt", encoding="utf-8") as f:
text = f.read()
image = Image.open("Bell.png")
data = np.array(image)
imageColors = wordcloud.ImageColorGenerator(data)
wc = wordcloud.WordCloud(background_color="black", font_path="SimHei.ttf", mask=data, color_func=image_colors)
wc.generate(text)
wc.to_file("FirstMotherfuckingPicture.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