Lomography, UNIX Style


I was cleaning up my del.icio.us bookmarks when I spotted this tutorial on Flickr on how to make your photos look like LOMO photos.

Erm... Why bother with Photoshop when you have ImageMagick?

Here's a first approximation using Fink's imagemagick-nox 5.5.1 package, and assuming we're dealing with 800x600 landscape images:

$ cat lomo.sh
# Fake feather effect
convert -size 80x60 xc:black \
        -fill white -draw 'rectangle 1,1 78,58' \
        -gaussian 7x15 +matte lomo_mask.png
mogrify -resize 800x600 -gaussian 0x5 lomo_mask.png
# Change contrast and saturation
convert -contrast 120 -modulate 100,120 original.jpg lomo.png
# Compose
composite -compose Multiply lomo_mask.png lomo.png output.png
# Output before/after sample
montage original.jpg output.png -geometry 480x320 -quality 100 montage.jpg

And here is a sample result:

All that's missing is the spherical gradient, which can only be done in ImageMagick version 6.

I wish whoever is maintaining the Fink package could update it soon, since I could have done the above much more cleanly like so (formula taken from here):

convert  -size 80x60 xc: \
         -fx '(1-(2*i/w-1)^4)*(1-(2*j/h-1)^4)' \
         lomo_mask.png
mogrify -resize 800x600 -gaussian 0x5 lomo_mask.png

Update: I don't use DarwinPorts because I find it too intrusive. There is, however, a binary release of ImageMagick 6.2.4 available.

Still, it's not bad for a quick hack. If I have the time, I'll try this out on a Fedora box later and post a complete script (including the spherical gradient).