Last Updated: June 11, 2021
· datn

Take a photo of yourself every time you commit (Linux)

Inspired by Victor Martinez' nearly identical post for OSX:

Use fswebcam
to capture a picture from the command line, and use the following as a post-commit script:

#!/usr/bin/env perl
use strict;
use warnings;
unless ( -d $ENV{"HOME"}."/.gitpix" ) {
    mkdir $ENV{"HOME"}."/.gitpix" or die "$!\n";
my $file="~/.gitpix/pic-".time.".jpg";
print "Saving image from webcam to $file.\n";
system "fswebcam $file" or die "$!\n";

Then use avconv, perhaps with ImageMagick morph transitions, to make the timelapse. Here's a little recipe for the shell, adapted from

mkdir tl
# change TR (transition) to # of frames to fade between images. 
# you probably want lower numbers when you have more images
convert .gitpix/*.jpg -delay $TR -morph $TR tl/%06d.transition.jpg
avconv -i tl/%06d.transition.jpg -r $FPS yourmovie.avi