Open Orosenthal opened 3 years ago
Hi Andreas, Yes, of course. For example, take the Twitter logo and fill it with common words. The thing is that I also want to change the background inside the logo itself (on which the words will appear) so that eventually a bird will remain on a white outer background with the words on a light blue background inside. Thanks. (BTW love your youtube class lectures)
And "background_color" doesn't work?
Or is the issue that then you'll also get the color outside the mask?
Or is the issue that then you'll also get the color outside the mask?
Exactly :)
Ok, but then you can just use your original mask to change the background color on the outside, right?
Ok, but then you can just use your original mask to change the background color on the outside, right?
twitter_mask = imageio.imread('./twitter_mask.png') wordcloud = WordCloud(width=800, height=500, stopwords = he_s_words, font_path = 'C:\Windows\Fonts\courbd.ttf',random_state=10, background_color='white',mask=twitter_mask,max_words=50,contour_color='blue', colormap='ocean',collocations=False, contour_width=0.15, min_font_size= 10).generate(get_display(text)) **** I only have the option to change the 'background_color' which changes all the figure (inside and outside)
this is the twitter_mask.png'
well you can do background_color='blue'
and then with the word cloud image that you get as result, you can
wc_image[twitter_mask == 255] = 255
or something like that to set the things outside the mask to white.
Thanks:)
Hi guys. I'd be interested in the same feature but I seem to understand slower than oro. I think I got this word cloud image you mentioned via the to_ image method. I have no idea how to manipulate the individual pixels of this object though. Could you please provide a little more insight into how I can work this out, too? Thanks Stegi
Hey Stegi. The line I gave above manipulates the pixels via broadcasting. It sets all the pixels that are outside the mask (where the mask is white) to 255 for all three channels, resulting in white.
Hi. Can you please explain a bit more what you are looking for? You can use full masks, but the background color is usually the same everywhere, with the color coming from the wordcloud. It should be relatively straight-forward to change the color outside the mask in post-processing, though.