Analyzing National Geographic Covers

Purely by chance and random surfing, I ended up here, staring at old covers from National Geographic. I was wondering if it is possible to analyze the evolution of the covers in some mildly scientific way. If you accept the fact that pictures are nothing else than three dimensional matrices , you can do quite a lot of things with them.

The figure below for example is created by averaging all RGB values for each pixel of the 1263 available covers.

Let’s start from the beginning. I scraped all available National Geographic covers up to December 2000 from here with some simple wget calls. Afterwards I used a batch script in gimp to rescale all covers to 630×420 and exported them as png files.

The R code below shows how the above figure was created.

#get the file names of cover files 
#sort them in increasing order (initial sorting is lexicographic)
A=array(0,dim = c(630,420,3))
for(f in lf){

The readPNG function reads the png files as three dimensional arrays. Each dimension is a 630×420 matrix that holds the RGB values for the pixels. So array A holds the average red, green and blue value for each pixel of all covers.

Average RGB Color of Covers

Another nifty thing you can do is calculate the average red, green and blue value for each cover.

for(f in lf){

The variable rgbs now holds the average RGB values for each cover. Plotting the values reveals an interesting pattern of how the colors of the cover changed over time.

The red, green and blue line show the average values stored in rgbs and the rectangular inset the corresponding rgb color for the three respective values.
Although the first illustrated cover appeared in July 1942, regularly illustrated covers didn’t appear until 1959, which is clearly visible in the above figure. Before 1959 it had a fairly standard layout from 1914 on and there is not much variety in colors. Before 1914, the cover was mostly redish. After 1959, each cover featured a unique illustration explaining the strong oscillation.

An Animated Moving Average of Covers

As a last step, we can visualize the evolution of the cover in a small animation, by creating a moving average cover over the whole set.

This is the simple R Code i used to generate the frames

#read the png files and save the matrices in a list 
for(f in lf){
#create a moving average by combining 100 consecutive covers 
for(i in 1:1164){
  A=Reduce("+", lop[i:(i+99)]) / 100

A word of warning: Better do not  save all matrices at once as done here. The list lop takes up quite a lot of space (~7.5GB).

The video is afterwards simply rendered via shell command
 ffmpeg -i %d.png macover.webm

And this is the final product. Enjoy!


Posted in: Data Analysis

Written by Dmathlete