Beautiful drop shadows now bow before me.

I got a lot of compliments on the design of the ignite session I did for Mil-OSS. Part of what made it work so well, I think, is the drop shadows, like you see here:

For a long time, I did these using the Gimp. It’s kind of a tedious process, especially if you are doing this for multiple images. Even if you automate it with a script, you have to start up the Gimp to get it to work. I wanted a way to do it from the command line, so I could convert a bunch of images at once.

So I wrote this quick script to use ImageMagick instead:

#!/bin/sh

if [ -z "$1" ]; then echo $0 '<filename>'; exit 1; fi;

filename=$(basename "$1")
extension=${filename##*.}
filename=${filename%.*}

convert -channel RGBA -colorspace RGB -background none "$1" 
( +clone -background none -shadow 60x5+10+10 ) 
+swap -layers merge +repage 
$filename-shadow.png

You’ll note that I always convert to PNG, because it’s important to preserve the transparency. If you convert to a JPG file, it’ll look terrible. So here’s an example. Notice that the shadow isn’t a square box — it actually follows the shape of the visible portion of the image. Shazam!

Before
After

One thought on “Beautiful drop shadows now bow before me.

  1. What you really want is Photoshop-style dynamically calculated layers in Gimp. I also wish for “smart shapes” which would be like having Inkscape embedded in a Gimp layer that dynamically calculates filters (drop shadows, etc) against the vectors.

    Like

Comments are closed.