IMPORTANT NOTE: I'm not sure this will work on every machine. I wrote that script especially for myself. If you discover a bug or know how to improve it, create an issue
Make sure you have these programs installed:
- python
- ffmpeg
- imagemagick
I highly recommend to use performance
CPU governor or the desktop may lag.
You can change the governor by using:
sudo cpupower frequency-set -g performance
You can permanently change the governor by editing file /etc/default/cpupower
.
Replace #governor='powersave'
with:
governor='performance'
Make sure to remove the #
!
Preview quality may not be accurate with actual wallpaper quality.
See also https://youtu.be/RJ0nsBiiqEYIMPORTANT NOTE: Paths must be global, example: /home/username/Pictures/file
not ./file
python main.py <type> <path> <frame update wait time (optional, default 0.05)>
- GIF (Best quality)
python main.py -gif /home/username/Pictures/mygif.gif
- Video (Worst quality)
python main.py -video /home/username/Videos/myvideo.mp4
- Image sequence (slideshow)
python main.py -sequence /home/username/Pictures/wallpapers/
- Last cached animation
python main.py -cache
First it takes the GIF/video and then converts it to frames.
- Video
os.system("ffmpeg -i "+path+" -vf fps=30 -vf scale=1280:720 cache/frame-%d.png")
- GIF
os.system("convert "+path+" -coalesce cache/frame.png")
- The frames are being saved in folder
cahce
that is located in the same directory as the script. (If you use-sequence
or-cache
nothing is being converted) - Next, it runs the 2nd script that is used for changing the wallpaper, with path and wait time arguments.
def runFromCache():
os.system("python " + os.path.abspath("./wallpaper.py") + " " + os.path.abspath("./cache") + " " + str(wait_time))
- Then the
wallpaper.py
keeps changing wallpaper to each frame.
while True:
time.sleep(wait_time)
for i in range(len(sequence_files)):
setWallpaper(path+"/"+"frame-"+str(i)+".png")
time.sleep(wait_time)
(See also setWallpaper(path)
inside code.)
Enjoy :)