[Home]WebComics/XkcdClickAndDrag

ec2-100-24-115-215.compute-1.amazonaws.com | ToothyWiki | WebComics | RecentChanges | Login | Webcomic

Big.

No, literally it contains 81 by 32 tiles each being 2048 by 2048 (some sparse). So that's nearly an 11 gigapixel image, stored in 6MB of 225 PNG tiles, for a full resolution of 165888 by 65536. I have it compressed into a 15MB PNG file, but good luck finding a viewer that will cope.

Code to build full image:

 #!/bin/bash

 LOWX=33
HIGHX=48
LOWY=13
HIGHY=19

 echo "P1 1 1 0" | pnmscale 2048 >nblank.pnm
echo "P1 1 1 1" | pnmscale 2048 >sblank.pnm

 for y in `seq -f "%gn" $LOWY -1 1` `seq -f "%gs" $HIGHY` ; do
for x in `seq -f "%gw" $LOWX  -1 1` `seq -f "%ge" $HIGHX` ; do
if ! test -e "$y$x.pnm" ; then
if ! test -e "$y$x.png" ; then
wget http://imgs.xkcd.com/clickdrag/$y$x.png
fi
if test -e "$y$x.png" ; then
pngtopnm <$y$x.png | ppmtopgm >$y$x.pnm
else
if test "n" = "`echo $y | sed -e "s/^.*\(.\)$/\1/"`" ; then
ln -s nblank.pnm $y$x.pnm
else
ln -s sblank.pnm $y$x.pnm
fi
fi
fi
done
done

 for y in `seq -f "%gn" $LOWY -1 1` `seq -f "%gs" $HIGHY` ; do
echo pnmcat -leftright `seq -f "$y%gw.pnm" $LOWX  -1 1` `seq -f "$y%ge.pnm" $HIGHX`
pnmcat -leftright `seq -f "$y%gw.pnm" $LOWX  -1 1` `seq -f "$y%ge.pnm" $HIGHX` >$y.pnm
done
echo pnmcat -topbottom `seq -f "%gn.pnm" $LOWY -1 1` `seq -f "%gs.pnm" $HIGHY`
pnmcat -topbottom `seq -f "%gn.pnm" $LOWY -1 1` `seq -f "%gs.pnm" $HIGHY` >all.pnm
pnmscale -reduce 8 all.pnm | pnmtopng >all_reduced.png
pnmtopng all.pnm >all.png

Note the ppmtopgm stage - this is because one of the tiles appears to be saved as a colour PNG rather than a greyscale PNG, even though it contains a greyscale image. This stage prevents the output file (all.pnm which is 9.5GB in size) from being three times the size.


http://blackhole12.blogspot.com/2012/09/analyzing-xkcd-click-and-drag.html

ec2-100-24-115-215.compute-1.amazonaws.com | ToothyWiki | WebComics | RecentChanges | Login | Webcomic
Edit this page | View other revisions | Recently used referrers
Last edited September 19, 2012 4:14 pm (viewing revision 4, which is the newest) (diff)
Search: