Linux noob needs help with wget command

Dan2013

Distinguished
Feb 24, 2011
24
0
18,510
So, I'm trying to set up a moving wallpaper on ububtu using the instructions found at this link:
http://www.simplehelp.net/2010/05/31/how-to-set-a-rotating-picture-of-the-earth-as-your-wallpaper-in-ubuntu/
Everything goes smoothly until I try to set the image as my wallpaper, at which point I get the following messages in image viewer:

Could not load image '1600.jpg'.
Error interpreting JPEG image file (Not a JPEG file: starts with 0x47 0x49)

I have tried different image URLs, but to no avail. Any suggestions?
 

bmouring

Distinguished
May 6, 2006
1,215
0
19,360
Browsers can be somewhat forgiving in terms of mislabeled filetypes (they usually will use some MIME-type determination techniques to determine the filetype), what happens when you run the file command on it? e.g.
Code:
brad@onyx:~$ file static.die.net/earth/mercator/1600.jpg 
static.die.net/earth/mercator/1600.jpg: GIF image data, version 89a, 1 x 1
 

bmouring

Distinguished
May 6, 2006
1,215
0
19,360
Ah, seems the admin behind that site got tired of people following those instructions and had any obvious wget req's for the image return a 1x1 GIF, if you work around this issue using the user-agent string modifier, things look much better:
Code:
brad@onyx:~$ wget -U foobar -R -N [url=http://static.die.net/earth/mercator/1600.jpg]http://static.die.net/earth/mercator/1600.jpg[/url]
--2012-02-29 00:27:07--  [url=http://static.die.net/earth/mercator/1600.jpg]http://static.die.net/earth/mercator/1600.jpg[/url]
Resolving static.die.net... 209.151.236.22
Connecting to static.die.net|209.151.236.22|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 146625 (143K) [image/jpeg]
Saving to: `1600.jpg'

100%[======================================>] 146,625      621K/s   in 0.2s    

2012-02-29 00:27:07 (621 KB/s) - `1600.jpg' saved [146625/146625]

brad@onyx:~$ file 1600.jpg
1600.jpg: JPEG image data, JFIF standard 1.01
Notice that I didn't even need to come up with a valid user-agent string, just the string "foobar" works fine (as usually they simply filter looking for wget reqs).

Notice that they likely did this for a very good reason (bandwidth costs, e.g.), so don't abuse it.