Every Day is Exactly the Same.

, by Frank Hellenkamp

We live in a box.

Or better — we are living in a number of boxes. Small and big, open and closed, some of them have holes, others are dark like in a »maulswurfshügel«. 

One of these boxes is my computer. It has a small hole through which one can see the world — it is something people call the world wide web — but when you think about it, it is just a number of other boxes you look into. 

My box.

Everydayisexactlythesame.net is an attempt to visualize my own box. Every five minutes a screenshot is automatically taken. And at the end of the day an average picture is computed for the respective day. 

 

Here an example for the average picture of January 1st, 2009 — a day I was busy with Flash (animation) and engrossed in several websites but still found the time for a game of The World of Goo

 

Graphically, it would not get you very far if you just took an average picture — all you would have is a rather vague grey — that is why several versions of the same picture are calculated: 

20090506 average

average 

20090506 equalize

equalize 

20090506 hard-light

hard-light 

20090506 multiply

multiply 

Automation

In order to facillitate the whole thing all tasks are automated via various bash scripts which are regularly executed via Cronjob. 

First step: Screenshots

Every five minutes a screen shot is automatically created for my MacBook. Furthermore an image of the outer world is shot with the help of the built-in iSight camera. 

#!/bin/bash
savedir="~/Projects/autoscreens"
fdate=`date "+%Y%m%d"`
ftime=`date "+%H%M"`
filescreen="$savedir/$fdate/screen_$ftime"
filereal="$savedir/$fdate/real_$ftime"

mkdir -p $savedir/$fdate/
if [ -f $savedir/nocapture ]; then
    # abort if screencapture is denied
    exit
else
    # capture screen 
    screencapture -m "${filescreen}_01.png" 

    # capture iSight-shot
    /opt/local/bin/isightcapture -t jpg "${filereal}_01.jpg"
fi

Second step: Automatic synchronization with the server

This data is automatically synchronized on a daily basis with a Linux server via rsync. Than the server executes all further tasks without actively involving the MacBook. 

#!/bin/bash
cd /var/transfer/autoscreens

fdate=`date "+%Y%m%d"`

# test if macbook is reachable in local network
if ping -q -c3 -w3 macbook.local > /dev/null; then

    # sync autoscreens
    rsync -avz \
        -e "ssh -i ~/.ssh/id_rsync" \
        --exclude "autoscreens/$fdate" \
        --exclude "autoscreens/.git" \
        --exclude "autoscreens/sorted" \
        --exclude "autoscreens/monthly_temp" \
            \
            user@macbook.local:/Users/user/Projects/autoscreens \
            \
            /var/transfer/

    if [ $? -eq 0 ]; then 
        # process images with a low priority
        nice -n 20 ./process
        nice -n 20 ./process_real

        # sort and upload images
        nice -n 20 ./sort

        # process monthy videos
        nice -n 20 ./monthly
    fi
fi

Third step: Processing the images

The processing takes place via convert from the ImageMagick suite and involves several variations. 

#!/bin/bash
#
# processing script for everydayisexactelythesame.net
# (c) copyright 2008-2009 Frank Hellenkamp [jonas@depagecms.net]

# level image
level() {
    if [ ! -f ${1}_level.jpg ]; then
        convert \
            ${1}.jpg \
            -level 20%,80% \
            ${1}_level.jpg
    fi
}

# equalize image
equalize() {
    if [ ! -f ${1}_equalize.jpg ]; then
        convert \
            ${1}.jpg \
            -equalize \
            ${1}_equalize.jpg
    fi
}

# filter image once
filter_single() {
    if [ ! -f ${1}_${2}_a.jpg ]; then
        echo --- filtering with ${2}

        convert \
            ${1}.jpg \
            +clone -compose ${2} -composite \
            ${1}_${2}_a.jpg

        level ${1}_${2}_a
        equalize ${1}_${2}_a
    fi
}

# filter image twice
filter_double() {
    if [ ! -f ${1}_${2}_b.jpg ]; then
        echo --- filtering with ${2}

        convert \
            ${1}.jpg \
            +clone -compose ${2} -composite \
            +clone -compose ${2} -composite \
            ${1}_${2}_b.jpg

        level ${1}_${2}_b
        equalize ${1}_${2}_b
    fi
}

if [ -f process.lock ]; then
    exit
fi
touch process.lock

for day in 200?????; do
    fdate=`date "+%Y%m%d"`

    if [ $day != $fdate ]; then
        options="-limit memory 384mb -limit map 384mb"
        temppath="/tmp/autoscreens/${day}_temp"
        outputpath="${day}_processed"

        mkdir -p $outputpath

        output="${outputpath}/average_${day}_01"
        if [ ! -f ${output}.jpg ]; then
            echo " "
            echo processing screen for $day:

            mkdir -p $temppath

            # resize images to the same size
            # regardless if they are captured from the 
            # build in screen or the external bigger
            # screen
            cd $day
            for file in screen_*.png; do
                convert \
                    $file \
                    -resize 936x624! \
                    $temppath/$file

            done
            cd ..

            # calculate average for images of one day
            convert $options \
                $temppath/screen_*.png \
                -average \
                ${output}.jpg

            rm -r $temppath
        fi

        # level and equalize image
        level $output
        equalize $output

        # pass thru all filters
        for filter in \
            "multiply" \
            "overlay" \
            "color-burn" \
            "hard-light"
        do
            filter_single $output $filter
            filter_double $output $filter
        done
    fi
done

rm process.lock

As you can see, through this process more than just the four images are generated. As these four images are generally the most expressive and aesthetic variants it is only those that are 

shown online. 

Fourth step: Publishing online

In a last step all new images are uploaded to the online server and can be seen directly under everydayisexactlythesame.net. Thumbnails and the images for the yearwall are only computed 

on demand and are cached locally. 

 

A small hint for those who are technically minded: 

The scripts are not yet up optimized in any way. However: /tmp is mounted as tmpfs in RAM on this specific Gentoo Linux installation, so access is fast and — what is more important — only those images that are subsequently needed will be saved on the hard disc.