My first computer was a Commodore 64. I have fond memories of paging through Commodore magazines, eyes closely examining every inch of the game advertisements, dreaming of what adventures lie within the game.

About 4 months ago I came across a complete PDF collection of every Compute Gazette and Run magazine. These were the exact magazines that I grew up with as a kid.

I started browsing around the PDF's. A smile quickly came to my face. A smile which only grew larger, feeding off the fuel of nostalgia that was billowing up inside me.

After all, who could resist smiling at such classic game ads:

I wanted to feel this happy nostalgia feeling again in the future. So I decided I would create some wallpaper montages out of these game ads.

Being a coder, I certainly wasn't going to do it by hand.

So I fired up my favorite code editor (Sublime Text 3) and created a new project!

NOTE: A link to the code is located at the bottom of this post.

Step 1 - Extract the PDF pages as images

This part was pretty easy as I had done it in the past. I simply used the pdfimages program provided by the poppler package.

This produced a bunch of PPM image files which I easily converted to PNG using ImageMagick's convert program.

Extracting the pages from 187 magazine issues produced 23,079 PNG files.

Step 2 - Remove duplicates

The same game ad would often appear in multiple issues, so the next task is to elimnate any duplicate images.

Since these are scans from 30 year old magazines, we'll never have an exact pixel match, so we'll have to use a program to check similarity.

For this task I used the puzzle-diff program from the libpuzzle package.

It's a dead simple program. Feed it two images and it will give you tell you the similarity between the two. Simply compare each page to every other page and remove any that are so similar they are likely duplicates.

Step 3 - Remove non-ad pages

A majority of the pages in these magazines are not game ads. Things like articles and code listings are unwanted. Time to filter these out.

With the help of the NPM module node-histogram, I compared each pixels RGB values average and standard deviation and against some values I came up through trial and error.

This comparison told me if the pixel was 'colorful' or not. Unless a minimum percentage of pixels were colorful, the image was discarded.

Step 4 - Remove boring pages with lots of text

When I browsed the remaining images, I found numerous images that contained enough color to pass my colorful test, but were clearly not game ads:

So next I decided to use OCR to remove pages with too much text.

To do the actual OCR I used the tesseract library.

Any pages with too many words on them were discarded.

Step 5 - Final pass by hand

The scripts I coded had done a remarkable job.

They reduced the original 29,079 images to about 800.

At this point I decided to just visually inspect the remaining images to remove any remaining bad ones.

Step 6 - Constructing the final wallpaper images

At the end, I had 627 cool ads sitting in a directory.

I randomly split the images up into five directories, then used ImageMagick to scale them down and montage them into the final wallpaper images.

Each image is about 5200x5400 in size, give or take a few thousands pixels.

I wrote a script a while ago to randomly choose a wallpaper image for each of three displays whenever I log in. If the image is larger than the resolution of that monitor, the image is randomly cropped for display.

The final Commodore game wallpaper images are now part of this rotation and whenever they are chosen, I smile :)

Final Results!

Here are the final results! Click on the images for the full size versions:


The code is a collection of node.js scripts that I created to perform all the tasks I mentioned above

You can find the code here:

NOTE: I haven't run the code in many months and I never intended to release it. It is unlikely to work "out of the box".