Você está na página 1de 5

Introduction

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, ! tutorials and you will
have a good basic understanding of how to use these graphic programs. Take a look at "intris, a T#tris $lone
for "indows I%ve written. &ou can find "intris on my site. The background of "intris was painted in GIMP
'.(. )ice, innit* +ut if you don%t have the time to learn how to use these programs, or you don%t want to learn
them ,ust for adding a simple shadow to an image, maybe there%s an easier way...
-hadow is a fascinating program which can add drop shadows to images. It%s a command line utility written
in $.. +ecause it is a command line program, you can add drop shadows to images in batch. -uppose you
have a site with !!! thumbnail images, you could add a drop shadow to all these images in seconds.
-hadow is based on GPaint, my program to generate Google/like logos.
To demonstrate the capabilities of -hadow, let%s put 0osh The 1gg to work. 0osh was born in Microsoft
1(pression, a wonderful vector graphics program. 2ere%s a picture of 0osh3

4sage
If you invoke -hadow without any arguments, it will display the options3

If you provide a file name on the command line and no options, -hadow will add a drop shadow to the image
and put the image on a white background3
1
Josh The Egg and The Return of the Shadows
$ollapse 5 $opy $ode
C:\>shadow josh.jpg

If you don%t want to modify the input file, you can specify an output file3
$ollapse 5 $opy $ode
C:\>shadow josh.jpg josh-with-shadow.jpg
6ptions
Option -s: shadow width
The width of the shadow is specified in pi(els. If you want a shadow of 7!, you invoke shadow like this3
$ollapse 5 $opy $ode
C:\>shadow -s:20 josh.jpg joshs.jpg

Option -b: border width
The background of the picture of 0osh The 1gg 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. 8 border can fi( this
problem3
$ollapse 5 $opy $ode
C:\>shadow -b: josh.jpg joshb.jpg
2

Option -m: margin
The margin is the area around the actual picture which e(poses the background. The margin is
e(pressed in pi(els. )ote that I%ve set the attribute border of the 9img: tag to '.
$ollapse 5 $opy $ode
C:\>shadow -m:20 josh.jpg joshm.jpg

Option -r: shadow direction
&ou can change the shadow direction by specifying the /r option on the command line. It%s argument
can be !, ', 7 or ;3
/r /r3' /r37 /r3;
Option -t: shadow transparency
-hadow uses the concept of layers, ,ust like in GIMP or Photoshop. &ou can change the opacity of the
shadow layer by specifying a number from !.! to '.! as an argument of the /t parameter3
$ollapse 5 $opy $ode
C:\>shadow -t:0.5 josh.jpg josht.jpg
+

Option -a: background color
&ou can change the color of the background specifying the color in he(adecimal notation. Invoking
-hadow like this will put 0osh on a green background3
$ollapse 5 $opy $ode
C:\>shadow -a:00FF00 josh.jpg josha.jpg

Option -c: shadow color
If you live on Mars, maybe you appreciate a red shadow3
$ollapse 5 $opy $ode
C:\>shadow -c:FF0000 josh.jpg joshc.jpg

Option -d: border color
$hanging the border color is also a piece of cake <don%t forget to specify a border width=>. )ote that
the ?uality of the image is influenced by the image format. The red border in this e(ample looks a bit
dirty. "hen the image is saved as a +MP file, the border color is ok.
$ollapse 5 $opy $ode
C:\>shadow -b:2 -d:FF0000 josh.jpg joshd.jpg
4

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
line3
$ollapse 5 $opy $ode
C:\>shadow -b:1 -n josh.jpg joshn.jpg

,
http://www.codeproject.com/Articles/8418/Josh-The-Egg-and-The-Return-of-the-Shadows

Você também pode gostar