def generate_image(words, image):
graph = np.array(image)
wc = WordCloud(font_path=os.path.join(CUR_DIR, 'fonts/simhei.ttf'),
background_color='white', max_words=MAX_WORDS, mask=graph)
wc.generate_from_frequencies(words)
image_color = ImageColorGenerator(graph)
return wc, image_color
评论列表
文章目录