Setting an Image as wallpaper directly from Internet in Ubuntu

It is easy to set an image as wallpaper which is downloaded from internet.
  • No need to open a browser and save as image and set it as wallpaper.
  • On startup, the image will be there as wallpaper directly from URL.
This is my code. Save it as shell script format (.sh). Add this script to your startup applications.

!/bin/bash echo "Open Change Wallpaper" 
cd .. 
rm /usr/share/backgrounds/(your default wallpaper).jpg
cd /usr/share/backgrounds
wget http://xxx/xxx.jpg
mv /usr/share/backgrounds/xxx.jpg /usr/share/backgrounds/xxx.jpg
mogrify -crop 1660x976+4+1972 xxx.jpg
gsettings set org.gnome.desktop.background picture-uri file:///usr/share/backgrounds/xxx.jpg
echo "Done change wallpaper"
 
Cropping image is an option. My image is too large and i want particular potion of the image as wallpaper so i choose mogrify. If you want then follow these steps.
* Install mogrify
* Open an image in GIMP.
* Using the Rectangle Select Tool (hotkey “R”), select the area you want to be cropped.
* Note the X, Y, Width and Height values GIMP gives you (have a look at the picture, you can find them in the GIMP main window).

mogrify -crop {Width}x{Height}+{X}+{Y} image.png
[xxx@localhost ~]$ mogrify -crop 643×393+7+83 image.png