You mentioned that "the obvious way" was a 16x16 grid, but to me the obvious way was to loop through red, green, and blue, setting the pixels as I went.
Written in PHP.
http://www.puremango.co.uk/2010/02/allrgb-entry-php-image-manipulation/