wget downloads corrupt JPEG file

Solution 1:

I think it's some kind of protection against direct downloads, nothing wrong with wget (the server is sending you a transparent 1x1 GIF image).

You can circumvent this by using wget with the -U flag, adding the user agent string of your browser, eg.:

wget -U "Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/534.17 (KHTML, like Gecko) Ubuntu/11.04 Chromium/11.0.654.0 Chrome/11.0.654.0 Safari/534.17" http://static.die.net/earth/mercator/1600.jpg

BUT: You should first ask the owner of that website if it's ok to download the content this way. There has to be a reason why the usual wget approach is blocked (maybe it's intentional, maybe it's just misconfiguration).