|
Quick And Dirty: Signatures Pt. 1 - The Command Line
by Mike Kost
Introduction
After hours working with Povray and rendering your latest and greatest
sphere on a
checkered plane image, there's nothing more satisfying than marking
your work with your illustrious signature. If you're new to the digital
graphics world, this may be easier said than done. This first article
in a two part series will demonstrate how to overlay a signature on
your new rendering using the ImageMagick command line tools.
Quick Reading
A few light reading links, maestro:
ImageMagick
ImageMagick is a software library and associated set of command line
tools for manipulating digital images. Basic operations like resizing,
rotating, or changing file formats (they claim to support over 90
formats - I'll take the word for it since the list is huge) are as
simple as a few taps on the keyboard. Beyond the basics, the command
line tools are able to do complex image creation including borders,
composite images, .GIF animation, and text rendering.
ImageMagick comes by default with just about every Linux distribution,
and is downloadable for Windows.
For this Quick and Dirty, I worked with ImageMagick 5.5.6 and in Linux.
Creating The Signature
Lets dive right in and create a signature. From the command line,
invoke the following[1]:
convert
-size 300x100 xc:black -gravity southeast -font symbol -pointsize 20 \
-fill gray33 -draw "text 10,30 'John Smith 2005'" signature.png
And, ta da

Well, if you squint, you can see John Smith's weird signature in the
lower right corner. That's great, but what did we just do? To figure
that out, lets deconstruct what was just executed
convert
|
'convert' is the ImageMagick
command line tool
|
-size
300x100
|
This says to generate an image
that 300 pixels wide and 100 pixels tall. This was picked arbitrarily,
and just has to contain the entire signature. Smaller is better as long
as the signature fits.
|
xc:black
|
This indicates that the
background should be filled black
|
-gravity
southeast
|
This indicates that the
signature is intended to go in the lower-right (southeast) corner
|
-font
symbol
|
This indicates that we'll be
using the Symbol font. To get a full list of all the fonts that are
available in the system, run 'identify
-list type'
|
-pointsize
20
|
This indicates the font size. A
point roughly translates to a pixel under the default configuration.
|
-fill
gray33
|
This indicates that we want to
use gray33 as the color. This roughly correspond to a #545454 gray.
Read on for why this color was chosen
|
-draw
"text 10,30 'John Smith 2005'"
|
This tells the system to write
the signature text (John Smith 2005). Because we're anchoring to the
southeast, the coordinates are a bit wonky. As run, the ImageMagick
places the upper right corner of the text (i.e. the 5) 10 pixels to the
left and 30 pixels up from the lower-right corner. Because it's offset
from the upper-right corner of the text, make sure to set the second
number greater than the pointsize, otherwise the text will be
chopped off.[2][4]
|
signature.png
|
This indicates the output file.
|
Applying The Signature
Now that we've got a signature, we've got to do something with it. I've
generated my latest and greatest sphere on plane image from sphere_on_plane.pov and rendered it.

Now, to combine it with my previously generated signature, I execute
the following
composite
-compose plus -gravity southeast signature.png sphere_on_plane.png
sphere_on_plane.signed.png
Again, what have we just done? Lets take a look
composite
|
Again, this is the command line
tool
|
-compose
plus
|
This indicates that we want to
take the two images and add[3] them together. The way the signature
shows up is by adding it to the current image - effectively making the
pixels lighter. This is why the signature was filled with gray33
instead of white. If white was used, the signature would end up white.
By using gray33 (or some other small gray value), the underlying image
shows through only lighter giving a watermark effect.
|
-gravity
southeast
|
This indicates that the
signature should be in the southeast corner. Because the signature is
smaller than the rendered image, we need to tell composite where to
position it. This command tells indicates to align it to the
lower-right corner.
|
signature.png
|
This is the file containing the
signature
|
sphere_on_plane.png
|
This is the file containing the
rendering to be signed
|
sphere_on_plane.signed.png
|
This is the signed output
|
And finally, our signed creation

Concluding Remarks
In the end, this tutorial was more an exercise in ImageMagick instead
of Povray. Still, it should provide a good base for tweaking and
establishing your own personalized signature.
Additional Reading
Notes and Disclaimers.
[1] - The backslash ("\") on the end of the first line is a
continuation marker for the Linux shell. I did this for formatting
reasons. This should be removed to get the command down to a single
line.
[2] - A more general case for the x,y text coordinates should be "text
offset,offset+pointsize 'Stuff'". The offset gives padding from the
lower-right corner.
[3] - Although this example uses the 'plus' function, if your image is
very light, consider using the 'difference' function. This makes the areas
under the signature darker instead of lighter. This is a personal
preference as well as artistic choice. In that case, the command line
would be
composite
-compose minus -gravity southeast signature.png sphere_on_plane.png
sphere_on_plane.signed.png
[4] - Since writing the article, I tried it using ImageMagick 6.x. and found
out that they corrected what looks like a bug. If you use 'southeast' gravity,
the text position is referenced from the lower-right corner instead of the upper-right corner.
The result of this is that you do not need to consider the high of the characters when
positioning the text.
Published: 06/02/05
Last edited: 09/26/05
Copyright (C) 2005 Mike
Kost
|
|