How to set a rotating picture of the earth as your wallpaper in Ubuntu

by Sukrit Dhandhania on May 31, 2010

Linux

Pictures of earth from space are the coolest. Wouldn’t it be great if we could get the latest images of what the earth looks like straight on our desktops? Die.net offers just such a service. They provide the latest computer generated image of what the earth might look like at the moment. Things like the cloud formations and the sunlight are taken into account. The result is a pretty up to date and stunning looking image, available to you and I for free. We can use some Ubuntu magic to bring that image down to our desktop and set it up as a rotating wallpaper. Let’s take a look at how to go about setting it up.

Scheduling a task can be done directly from the command line if you are familiar with how to do it. For users who are not very geeky, there is a simpler option in Gnome Schedule. To install the gnome task scheduler launch a terminal window and execute the following command:

# sudo apt-get install gnome-schedule

After the installation is complete Gnome Schedule will be available in your Ubuntu menu. Go to Applications -> System tools -> Schedule tasks. In Gnome Schedule click on New. This will launch the configuration window for a new task. Enter something like Moving Wallpaper in the Description: section.

In the Command: section, enter:

wget -r -N http://static.die.net/earth/mercator/1600.jpg

If you’re not familiar with wget, it is a very powerful command line download tool. The URL we feed it here is where the most up to date image of the earth is made available by the fine folks at die.net. They make a new image available every three hours.

image01

Next is the Default Behaviour drop down menu. Select the Suppress Output option here.

image02

After this you will need to schedule the task. As you don’t want to flood the die.net server it might be a good idea to download the image from their server once a day. To do that set the scheduler to Every day. You can set something more specific if you like by going to the Advanced section and setting up a higher frequency. Note that the image is updated once every three hours, and not with a greater frequency. So if you set it to download the image every few minutes, it will download the same image again and again – wasting both your bandwidth and die.net’s. So at a very minimum, set the update frequency to every 3 hours. Once you are done hit the Add button to wrap things up.

image03

In the last step what we did was to setup a task to download the latest image. This image is by default saved to the home directory of the user that set it up. The image goes into a path like this /home/username/static.die.net/earth/mercator/1600.jpg. This is where all the files that are downloaded will get stored. The old image will be replaced by the new one.

Now we need to setup our Ubuntu box to pick up the image as the wallpaper. To do that right click on your desktop and pick Change Desktop Background. Click on the Add option in the Appearance Preferences that opens. Now navigate to /home/username/static.die.net/earth/mercator/1600.jpg and hit Open. Click Close on the Appearance Preferences window.

image04

Here’s the final result. My Ubuntu Lucid Lynx machine with the stunning view from the sky.

image05
click to enlarge

  • http://stealthgyro.com Chris

    Depends: python(<2.5) but 2.6.5-0ubuntu1 is to be installed .. is the dependencies error I get whenever I try to get gnome-schedule in my lucid lynx

  • dl

    damn i love this feature!

  • Pingback: Set A Rotating Picture Of The Earth As Your Ubuntu Wallpaper | Lifehacker Australia

  • Marko

    Is there any way to get Os X to do this? Are the terminal commands the same?

  • Pingback: How to set a rotating picture of the earth as your wallpaper in Ubuntu « The Jungle Online

  • Pingback: Set a Rotating Picture of the Earth as Your Ubuntu Wallpaper [Wallpaper] | News Update

  • http://ben.kulbertis.org/ Ben Kulbertis

    Very cool, thanks for coming up with this!

  • Ola

    Awesome choice of wallpaper!

  • akendrick451

    When I try this, my background is only partially drawn. I have the top half of the picture of the earth showing and grey screen below that. Any ideas why? Do I have to manually get ubuntu to refresh the background?

  • http://yep.com wooden

    so if you’re like me your resolution may not be 1600. I used a combination of convert to resize the resolution on the fly to my laptops. I changed my crontab command to be :
    ‘wget -N http://static.die.net/earth/mercator/1600.jpg -O – | convert – -resize 1400×1050 1400.jpg >/dev/null 2>&1′

    where my resolution is 1400 x 1050. Don’t forget to add ‘ -O – ‘ to the wget command to pipe it correctly! Also I saw no point to add wget -r since this is recursive and you’re already grabbing the direct file. PLUS you can have up update more than every three hours since the -N will check if the timestamp is changed and only grab a new one if it changes.

  • Jacob

    @akendrick451: The grey lower portion of your background sounds like the image is corrupt. This could happen if your Internet connection stalled while the image was being downloaded. Try opening the image in a photo application: if the image is corrupt, you’ll see the corruption there too. If the image is corrupt, then you can download it again, and that should fix it.

  • akendrick451

    @Jacob: Thanks for the reply. When I open the image in a photo application it shows correctly. When I click on the desktop background and Change Desktop Background, if I set the Style from Zoom to Span, then the image shows correctly.
    Any ideas why? Should I leave it at Span?

  • Mams

    nice idea! you can simply (and not install gnome schedule with

    crontab -e
    0 * * * * wget -r -N http://static.die.net/earth/mercator/1600.jpg -O /anyPathYouWant/sunlight.jpg >/dev/null 2>&1

    and then set it has your background
    (0 * * * * = every hour, put 0 0 for once/day)

  • Phil

    I was getting the lower grey portion when the image automatically updated. If I switched the wallpaper then switched back it fixed it. So I now do the following:

    wget -r -N http://static.die.net/earth/mercator/1600.jpg; gconftool-2 –type string –set /desktop/gnome/background/picture_filename “/home/user/static.die.net/earth/mercator/1600.jpg”

    Which grabs it, then changes it to itself (I.e. refreshes it). Note: change /user/ to your username.

  • ajfrank

    L’immagine viene scaricata (la scarico ogni 5 minuti), ma non viene fatto il refresh del desktop… come posso fare?

  • ajfrank

    I download the image every 5 minutes, but desktop dosn’t refresh… the image is dowload good.

  • omfg

    picture is half gray most of the time and i am on 50mbit

  • Björn

    I have the same “background half grey”-problem, and the tip from Phil does not help, this was how i was doing it the whole time…

    The image is always downloaded correctly when this happens ( it does not happen always, just sometimes).

    To me it feels like a concurrency issue / race condition thing (perhaps due to multicore processor?). I could imagine something like the file is being downloaded and finished and gnome sees the new file (yes, it doesn’t need the gconftool thing, it automatically detects if the background image changes, at least for me), but when it is loading the file is not finished on disk, still partly in cache from the other processor, and gnome reads the file only partially. Setting it then again via gconftools does not help because it already updated to that image and does not see anything new… but this is just pure speculation.

    I played with a seperate script to first copy the image to a backup copy, setting background to that copy, then downloading and then switching to the new image, insert sleeps into the script file and tried various things, with no success. However all image files on the disk are correct when i open them in another application.

    Funny other observation is, it does this “partial half grey” thing only (but not always!) when my script is run by cron, when i run it manually it always works..

    I know this comments here are some months old, but maybe someone else found a solution or has a new idea?!

    Regards

  • Björn

    Should have focused on the cron thing earlier, it is really a problem of cron running gconftool, because recent gconftool uses DBUS and needs some environment vars which are not set in default shell, so gconftool does not really run within a cronjob.

    See http://wwww.ubuntuforums.org/showthread.php?p=9109780 for a workaround, it exports these vars.

  • Pykler

    Die.net now checks user agent strings, you must add –user-agent=”Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6″ or similar switch to the command

  • http://www.simplehelp.net Ross McKillop

    Pykler – thanks for the update!

  • Scott Long

    How do you make it so that the new image over-writes the old? Because the new image is 1600.jpg1 the image never changes….

  • Hubu

    Partial filling of images started at ubuntu10.04,that’s why i still use Linux Mint 8(Ubuntu 9.10).
    But now I have another problem and it affects Linux Mint 9,after downloading the image is not viewable.To attempt to view the image appears the following error (Not a JPEG file: starts with 0×47 0×49)
    If i download the image with a web browser it’s viewable…

  • Unnic

    I can’t view the downloaded fileERROR: (Not a JPEG file: starts with 0×47 0×49)

    Any solutions? I would love to have this as my wallpaper

  • http://realtimesunlightwallpaper.weebly.com/ Carles Sentis

    There’s an application for this in Ubuntu

    http://realtimesunlightwallpaper.weebly.com/

    Make sure you have curl installed as it is dependent on it by typing this in the terminal

    $ sudo apt-get install curl

  • http://ms1.gotdns.com jonny rocket

    wow. amazing!

  • Balliver

    I am having the same problem as some others, the file the scheduled task creates is only 37 bytes big and contains no image, I get the same problem running wget -r -N http://static.die.net/earth/mercator/1600.jpg from a terminal… any suggestions?

    Ubuntu 10.10 64bit.