In OS X Yosemite, setting your Desktop Image from the Terminal.app or any other cli (command line interface) is as easy as...

sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db "update data set value = '/path/to/your/image.jpg'" && killall Dock

This can be made into a function you can add to your .profile, .bashrc, .zshrc, and so on...

function setDesktopImage() {
	sqlite3 ~/Library/Application\ Support/Dock/desktoppicture.db "update data set value = '$1'" && killall Dock
}

You can then call the function like this:

$ setDesktopImage ~/path/to/your/image.jpg