change wallpaper command line linux

C++
#To get directory of background iamge
$ gsettings get org.gnome.desktop.background picture-uri
'file:///usr/share/backgrounds/warty-final-ubuntu.png'
xsetbg /path/to/wallpaper.jpg

Source

Also in C++: