Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


A procedurally generated surrealist photoset

Generate images that resemble surrealist portrait photomontages in the style of Man Ray. Uses the following resources:

  • The Flickr API and Internet Archive Commons account to grab period images
  • Runs face detection (packaged with OpenCV to identify human faces for candidate portraits
  • Blends face and non-face images using some best guesses about optimal blending algorithms (multiply or screen work best)

The source code in this repository is in the public domain.

The book


After dozens of code runs I selected my favorite images and laid them out into a book with two-page spreads. No changes were made to the images themselves. [Browse all 140 pages online.] (

A 140-page [PDF version] (, best viewed as 2-up, is also available (Warning: 240 MB) or [in print from Blurb.] (

Source code installation

Generate your own book by tweaking parameters in the source code!

Set up a virtual environment:

virtualenv ve

Ensure that you have various image libraries installed (for OS X users, brew install libjpeg and brew install libpng).

Install the dependencies:

. ve/bin/activate
python develop

Installing numpy and OpenCV are a huge pain. You've been warned.

This worked for me:

(Your version of OpenCV will be newer; link the files into your ve.)

In manray/, update this:

CASCADE_FILE = '/usr/local/Cellar/opencv/'

If numpy doesn't install, uninstall python via brew and update it, setuptools, and pip. pip install numpy should then work.

Get a Flickr API key and add it to a directory called secret:

mkdir secret
cat "FLICKR_KEY = 'YOUR-KEY-HERE'" > secret/

Run the program:

python manray/

The program should go off and acquire a lot of images from Flickr and try to generate nice output. Depending on your search parameters you can expect to get around 10 decent images out of each run.

Once it runs, it will cache the resulting images (as local pickle files) in manray/cache and pull a random set from those. Delete that directory to re-acquire the assets from Flickr.

The output will be in manray/build/.

Example output

Browse all 140 pages online

Page Page Page Page Page Page Page Page Page Page Page Page Page Page


Generate a 20s-style surrealist book




No releases published


No packages published