The standard way to add a drop shadow to an image is to fire up GIMP or Photoshop, add a background layer, add a transparent layer, select a rectangular area the size of the image you want to give a drop shadow, blur it, add a new transparent layer, paste the image in the layer, move the layer with the blurred shadow a bit to the right and to the bottom and finally flatten the layers. If you know how to use GIMP or Photoshop, this is no big deal. If you never did this before, follow the steps in, say, 40 tutorials and you will have a good basic understanding of how to use these graphic programs. Take a look at Wintris, a T*tris Clone for Windows I've written. You can find Wintris on my site. The background of Wintris was painted in GIMP 1.x. Nice, innit? But if you don't have the time to learn how to use these programs, or you don't want to learn them just for adding a simple shadow to an image, maybe there's an easier way...
Shadow is a fascinating program which can add drop shadows to images. It's a command line utility written in C#. Because it is a command line program, you can add drop shadows to images in batch. Suppose you have a site with 4000 thumbnail images, you could add a drop shadow to all these images in seconds. Shadow is based on GPaint, my program to generate Google-like logos.
To demonstrate the capabilities of Shadow, let's put Josh The Egg to work. Josh was born in Microsoft Expression, a wonderful vector graphics program. Here's a picture of Josh:
If you invoke Shadow without any arguments, it will display the options:
If you provide a file name on the command line and no options, Shadow will add a drop shadow to the image and put the image on a white background:
If you don't want to modify the input file, you can specify an output file:
C:\>shadow josh.jpg josh-with-shadow.jpg
Option -s: shadow width
The width of the shadow is specified in pixels. If you want a shadow of 20, you invoke shadow like this:
C:\>shadow -s:20 josh.jpg joshs.jpg
Option -b: border width
The background of the picture of Josh The Egg is white. If you add a drop shadow to this picture and you put it on a white page, the edges of the picture are not clearly visible. A border can fix this problem:
C:\>shadow -b: josh.jpg joshb.jpg
Option -m: margin
The margin is the area around the actual picture which exposes the background. The margin is expressed in pixels. Note that I've set the attribute border of the <img> tag to 1.
C:\>shadow -m:20 josh.jpg joshm.jpg
Option -r: shadow direction
You can change the shadow direction by specifying the -r option on the command line. It's argument can be 0, 1, 2 or 3:
Option -t: shadow transparency
Shadow uses the concept of layers, just like in GIMP or Photoshop. You can change the opacity of the shadow layer by specifying a number from 0.0 to 1.0 as an argument of the -t parameter:
C:\>shadow -t:0.5 josh.jpg josht.jpg
Option -a: background color
You can change the color of the background specifying the color in hexadecimal notation. Invoking Shadow like this will put Josh on a green background:
C:\>shadow -a:00FF00 josh.jpg josha.jpg
Option -c: shadow color
If you live on Mars, maybe you appreciate a red shadow:
C:\>shadow -c:FF0000 josh.jpg joshc.jpg
Option -d: border color
Changing the border color is also a piece of cake (don't forget to specify a border width!). Note that the quality of the image is influenced by the image format. The red border in this example looks a bit dirty. When the image is saved as a BMP file, the border color is ok.
C:\>shadow -b:2 -d:FF0000 josh.jpg joshd.jpg
Option -n: no soft shadow
If you don't want a soft shadow, you can turn it of by specifying the -n parameter on the command line:
C:\>shadow -b:1 -n josh.jpg joshn.jpg