XKCD Click and Drag Dumper

Filed under: Programming — Tags: , , — Sebbs @ 9:25 pm September 19, 2012

So, one of the web comics I read frequently is XKCD. The fourth panel of today’s comic was basically a huge, scrollable image, with basically many smaller jokes hidden within. It’s alot of clicking and dragging to see everything though, so I started looking at how it was put together.

After profiling the network traffic to my browser while scrolling around, I quickly realised it was actually a collection of smaller images, pieced together by a script. Each of the smaller images is named in a coordinate system, being [number][n or s][number][e or w].png (for example, 1n1e.png, 2n1e.png etc). So, I figured writing something to grab these images out should be trivial.

XKCD Click and Drag Dumper.exe is the result so far. This is a small Windows¬†console application written in C# .NET 3.5 that will download and save each available image into a clickdrag folder in the same directory as the executable. Although it’s threaded, the threads quickly end up competing for disk resource, so they’ve been limited a bit at the cost of runtime. Note that some may appear to be missing; these are actually just plain black or white cells that the script at XKCD fills in automatically.

I’m planning another iteration of this program that will stitch the images together into one giant image.¬†A raw bitmap of the entire image (including the blank black/white-only cells) will be about 10GB (assuming 1 byte per pixel), so doing it in a way that isn’t going to kill the average PC will be a bit of a challenge.

(I may also post the code later if I get enough requests)

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment