I just published small Go project on GitHub:
https://github.com/jumbleview/decor
This is the program which takes jpeg picture as argument and set it as Windows desktop background.
Command line looks like this:
- decor.exe [-s] path_to_jpeg_file
It starts with single argument: path to jpeg file. If before an argument there is the flag -s program starts in silent mode (without console).
Program reads jpeg file, encodes it, crops image so it's width-to-height ratio matches width-to-height ratio of computer monitor, saves the image as bmp file and sets it as a screen background.
It is pure Go program. It should be compiled with command
go build -ldflags -H=windowsgui
Using such flags allows to start without Windows console attached. Console is created dynamically or suppressed by flag -s.
This program allows to change background by desktop shortcut, batch file or schedule background change with Task scheduler.
Update on September 13, 2024.
One more project on GitHub:
It is more advanced version of background utility. It starts with such command:
- picshuffle.exe [-s] [-l] path_to_folder_or_jpeg_file
If argument is a path to a jpeg file program works exactly as decor.exe.
In case argument is a path to a directory with some jpeg files program reads content of directory and randomly picks one file from that directory to set it as a desktop background. Program tracks selected files in storage picshuffle.db so once selected file will not be selected again till all files from this directory are taken.
I personally use this program out of Windows task scheduler at logon event. Each time after a logon into the system I see different background picture.
To track selected files program uses embedded key-value store bolt (go.etcd.io/bbolt). If started with flag [-l] program prints list of files used as a background within last 365 days.