Wordcount wallpaper (from .bash_history file)
code
import os
from wordcloud import WordCloud
import numpy as np
from PIL import Image
from datetime import datetime
WIDTH=1280
HEIGHT=800
MAX_WORDS=2000
BG_COLOR='#000000'
usr=os.path.expanduser('~')
txtFile=usr+"/.bash_history"
maskFile=usr+"/Pictures/Wallpapers/SolusMaskHD.png"
wallpaperPath=usr+"/Pictures/Wallpapers/wordcloud_"+datetime.now().strftime("%d-%m-%Y_%H-%M-%S")+".png"
txt = open(txtFile, 'r').read()
solus_mask = np.array(Image.open(maskFile))
wc = WordCloud(width = WIDTH, height = HEIGHT, background_color=BG_COLOR,max_words=MAX_WORDS, mask=solus_mask, random_state=1).generate(txt)
wc.to_file(wallpaperPath)
#Simple wordcount
#wc = WordCloud(width=WIDTH,height=HEIGHT,max_words=MAX_WORDS,background_color=BG_COLOR,min_font_size=10 ).generate(txt)
#wc.to_file(wallpaperPath)
save the above code as wordCount.py (set the parameters if required)
save the below mask file (HD and 4K) to ~/Pictures/Wallpapers
in terminal install python package (if any other error install those python packages too)
sudo pip3 install wordcloud
python3 wordCount.py
it will generate the output file in ~/Pictures/Wallpapers
then set as a wallpaper.
I used .bash_history
as text file.
HD mask file
4K mask file