Every Day is Ex­act­ly the Same.

, by Frank Hel­lenkamp

We live in a box.

Or bet­ter — we are liv­ing in a num­ber of boxes. Small and big, open and closed, some of them have holes, oth­ers are dark like in a »maulswurf­shügel«. 

One of these boxes is my com­put­er. It has a small hole through which one can see the world — it is some­thing peo­ple call the world wide web — but when you think about it, it is just a num­ber of other boxes you look into. 

My box.

Everydayisexactlythesame.​net is an at­tempt to vi­su­al­ize my own box. Every five min­utes a screen­shot is au­to­mat­i­cal­ly taken. And at the end of the day an av­er­age pic­ture is com­put­ed for the re­spec­tive day. 

 

Here an ex­am­ple for the av­er­age pic­ture of Jan­u­ary 1st, 2009 — a day I was busy with Flash (an­i­ma­tion) and en­grossed in sev­er­al web­sites but still found the time for a game of The World of Goo

 

Graph­i­cal­ly, it would not get you very far if you just took an av­er­age pic­ture — all you would have is a rather vague grey — that is why sev­er­al ver­sions of the same pic­ture are cal­cu­lat­ed: 

20090506 average

av­er­age 

20090506 equalize

equal­ize 

20090506 hard-light

hard-light 

20090506 multiply

mul­ti­ply 

Au­toma­tion

In order to facil­li­tate the whole thing all tasks are au­to­mat­ed via var­i­ous bash scripts which are reg­u­lar­ly ex­e­cut­ed via Cron­job. 

First step: Screen­shots

Every five min­utes a screen shot is au­to­mat­i­cal­ly cre­at­ed for my Mac­Book. Fur­ther­more an image of the outer world is shot with the help of the built-in iSight cam­era. 

#!/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

Sec­ond step: Au­to­mat­ic syn­chro­niza­tion with the serv­er

This data is au­to­mat­i­cal­ly syn­chro­nized on a daily basis with a Linux serv­er via rsync. Than the serv­er ex­e­cutes all fur­ther tasks with­out ac­tive­ly in­volv­ing the Mac­Book. 

#!/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: Pro­cess­ing the im­ages

The pro­cess­ing takes place via con­vert from the Im­ageMag­ick suite and in­volves sev­er­al vari­a­tions. 

#!/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 im­ages are gen­er­at­ed. As these four im­ages are gen­er­al­ly the most ex­pres­sive and aes­thet­ic vari­ants it is only those that are 

shown on­line. 

Fourth step: Pub­lish­ing on­line

In a last step all new im­ages are up­loaded to the on­line serv­er and can be seen di­rect­ly under everydayisexactlythesame.​net. Thumb­nails and the im­ages for the year­wall are only com­put­ed 

on de­mand and are cached lo­cal­ly. 

 

A small hint for those who are tech­ni­cal­ly mind­ed: 

The scripts are not yet up op­ti­mized in any way. How­ev­er: /tmp is mount­ed as tmpfs in RAM on this spe­cif­ic Gen­too Linux in­stal­la­tion, so ac­cess is fast and — what is more im­por­tant — only those im­ages that are sub­se­quent­ly need­ed will be saved on the hard disc.