[magick-users] Adding text to an image
zentara
zentara1 at sbcglobal.net
Fri Nov 21 08:53:16 PST 2008
On Fri, 21 Nov 2008 09:20:00 -0600
"Greg Lindstrom" <gslindstrom at gmail.com> wrote:
>Hello,
>
>I am using 'convert' to add a claim number to a tif image and convert it to
>a pdf image. My problem is that the scans we are processing sometimes are
>not ideally aligned and have a black border, so we can not read all of the
>claim number. Can I define a white background behind the claim number so I
>can always read it? How is that done? If you could give a short
>explination or point me to the appropriate documentation I would be
>grateful.
>
>Thanks,
>--greg
See http://www.imagemagick.org/Usage/annotating/
I'm not the best at these commandline usages, I usually use Perl,
but here is something to get you started. It makes a test.tif that is black,
then make a second tif that is white, and contains the black number, then it overlays it.
You can alter the script to take a file=$2 argument, so you can
process your tifs in batches.
#######################################
#!/bin/sh
#usage: ./thisscript number
num=$1
# make a test tif in black
convert -size 300x300 xc:black comp.tif
# manually make the number image and composite it atop
convert -size 150x50 xc:white comp1.tif\
-font Generic.ttf -pointsize 36 -fill black -stroke black \
-gravity 'Center' \
-annotate 0 $num \
comp1.tif
convert comp.tif comp1.tif -compose ATop -geometry +30+30 -composite comp3.tif
#########################################
I'm sure there is a better way, maybe Mr. Thyssen will chime in with improvements. :-)
zentara
--
I'm not really a human, but I play one on earth.
http://zentara.net/Remember_How_Lucky_You_Are.html
More information about the Magick-users
mailing list