Decoding The Complete National Geographic Images

June 2012

My dad had a subscription to National Geographic and I can remember spending hours thumbing through the shelf of yellow magazines. There was one article about a team of rock climbers that set up a "wall camp" hanging from the side of a cliff, and the image has stuck with me for years. So when I saw The Complete National Geographic on Amazon for $40, it was an instant purchase.

National Geographic, January 1999, pp86–87.

The collection came on 6 DVDs and contains scans of every page of every issue from 1888 through 2009. There's an option to install everything to a hard drive, so I spent an evening disc swapping while playing Roller Coaster Tycoon and now have the collection in a folder. It's actually really cool, and the sheer amount of content is really fantastic.

But the app sucks.

The viewer is an Adobe Air app and runs poorly even on my Mac Pro. The interface is bogged down by unnecessary, clunky animations. Browsing by geographic location is terrible, and the search interface is inscrutable. Would you believe that the way to dismiss that mess in the screenshot below is to click the yellow downward pointing arrow to the right of "Browse by Year"?

Fortunately, it's fairly easy to extract the images from the collection. They're organzied in a straightforward folder hierarchy, so the January 1999 issue is at the path images/199x/19990101, and pages 86 and 87 are named NGM_1999_01_114_4.cng and NGM_1999_01_115_4.cng. The magazine's front matter screws up the page numbering a bit, but it's still easy enough to find the appropriate file.

The files don't appear to be images, but this article on CNG files notes that they're actually just JPEG files that have had each byte xor'd with 0xEF.

That site also has a TCL script for converting them, but it's insanely slow. I wrote a new version in C. On my machine, it can convert the entire collection in about 45 minutes.

Build it, then run it with something like this:

cng2jpg /path/to/images/199x/1990101/*.cng

It will automatically copy and rename all the files, so the converted version of NGM_1999_01_114_4.cng will be saved in the same directory as NGM_1999_01_114_4.jpg.

I think what I really want is an iOS app that downloads and caches the issues on demand, but for now, I can convert the images, copy them to my iPad, and read them there. It's pretty much great.

cng2jpg Source Code