Wednesday, September 19, 2012

Today xkcd

So, after today xkcd, and a lot of wasted time... I decided to try to download all the images so I could see ALL the "world" without having a tendinitis in my hand...
Where is how I did it: (For the lazy ones, the files are on this zip:  https://www.dropbox.com/s/otyt0jlqu2nbau2/xkcd.zip )
In firefox I right clicked on the image and choose "View Image Info", and noticed that the original image is: http://imgs.xkcd.com/clickdrag/1n1e.png
So I click 'n drag a little, and a pattern start to emerge in the filenames: 1n2e.png, 1n3e.png, 1s7e.png, 1n1w.png, etc..
So the pattern is a very simple coordinate system: a number representing the latitude, followed by an 'n'(North) or 's' (South), and a number representinde longitude follow by 'e'(East) or 'w'(West). The next step was to download all the files programmatically... wget came right to my mind...
So usign bash, I just coded the following script:

#!/bin/bash
for i in {1..20}
do
for j in {1..50}
do
wgethttp://imgs.xkcd.com/clickdrag/${i}n${j}e.png
done
done

for i in {1..20}
do
for j in {1..50}
do
wget http://imgs.xkcd.com/clickdrag/${i}n${j}w.png
done
done

for i in {1..20}
do
for j in {1..50}
do
wget http://imgs.xkcd.com/clickdrag/${i}s${j}e.png
done
done

for i in {1..20}
do
for j in {1..50}
do
wget http://imgs.xkcd.com/clickdrag/${i}s${j}w.png
done
done
Not very beautifull... But does the work...
But I can do better:
#!/bin/bash
for lt in 'n' 's'
do
for lng in 'e' 'w'
do
for i in {1..20}
do
for j in {1..50}
do
wget http://imgs.xkcd.com/clickdrag/${i}${lt}${j}${lng}.png
done
done
done
done
It will run a little slow, because not all images that we try to download are there... But it works...
Here all all the images that I have download (225 to be more precise) in a zip file (4.5MB):
https://www.dropbox.com/s/otyt0jlqu2nbau2/xkcd.zip

Have fun!

Next steps: Merge all the images in a big detailed image! Maybe tomorow...

Cheers,
Belitano.

1º Post

I just seen today xkcd, and decided to make a little post about it.
Since I hadn't a blog to make the post, I decided to start one...
Do not expect a lot of  content updates.

Cheers,
Belitano.