Discussion:
convert -draw text with numbers problem
Jim Shupert, Jr.
2011-07-21 20:59:17 UTC
Permalink
friends

I have a difficulty with convert -draw text

with my script of


#!/bin/bash
# make bba slate vers 1 js 7.21.2011
#############################
##
echo "----------------< slate start >-------------"

## here are some vars 6 lines 6 vars
dbIDVal=FA000747
srcVal=WBEN-TV
slugVal=nnnnnnnnnn
dateVal=yyyy/mm/dd
lenVal=10:00
#lenVal=number
sndVal=SOF

#lin 1 --DatabaseID#

convert ~/bba/bba_blank.png \
-fill black -pointsize 25 -draw "text 70,160 'Database ID#'" \
-fill black -pointsize 25 -draw "text 240,160 $dbIDVal" \
-fill black -pointsize 25 -draw "text 70,200 'Source'" \
-fill black -pointsize 25 -draw "text 240,200 $srcVal" \
-fill black -pointsize 25 -draw "text 70,240 'Slug'" \
-fill black -pointsize 25 -draw "text 240,240 $slugVal" \
-fill black -pointsize 25 -draw "text 70,280 'Date'" \
-fill black -pointsize 25 -draw "text 240,280 $dateVal" \
-fill black -pointsize 25 -draw "text 70,320 'Length'" \
-fill black -pointsize 25 -draw "text 240,320 $lenVal" \
-fill black -pointsize 25 -draw "text 70,360 'Sound'" \
-fill black -pointsize 25 -draw "text 240,360 $sndVal" \
~/bba/slate4.png


i get an error of

convert: Non-conforming drawing primitive definition `text' @
draw.c/DrawImage/3140.

due to lenVal=10:00
it hates numbers?
i also ahve a problem if i make
dateVal=yyyy/mm/dd something like dateVal=2011/07/21

It seems no amount of double quotes , etc etc seem to work
and Yet I think - there must be a way
so my Q is


also i should mention the above script successfully makes a png.
but the $lenVal ( if the value is numbers ) is blank

THANKS!

j
Fred Weinhaus
2011-07-21 23:00:21 UTC
Permalink
Put single quotes around your variable in the draw statement. That
works for me on IM 6.7.1.0 Q16 Mac OSX Tiger.

E.G.

lenVal=10:00
convert -size 500x500 xc:white -fill black -pointsize 25 -font Arial
-stroke black -draw "text 240,320 '$lenVal'" tmp.png
Anthony Thyssen
2011-07-22 02:43:23 UTC
Permalink
On Thu, 21 Jul 2011 16:59:17 -0400
magick-users-***@imagemagick.org wrote:
| friends
|
| I have a difficulty with convert -draw text
| ...
| -fill black -pointsize 25 -draw "text 240,160 $dbIDVal" \
| -fill black -pointsize 25 -draw "text 70,200 'Source'" \
| -fill black -pointsize 25 -draw "text 240,200 $srcVal" \

The variables still need quotes.

These are needed by IM to separate the sring from the other draw
options.

EG:

-fill black -pointsize 25 -draw "text 240,200 '$srcVal'" \

Also major warning. be sure to check the inserted variables
for single quotes and backslashes, or draw make get confused!

See Drawing Special Characters in the Text Strings
http://www.imagemagick.org/Usage/draw/#text


Anthony Thyssen ( System Programmer ) <***@griffith.edu.au>
--------------------------------------------------------------------------
The chieftain had been turned into a pumpkin, although in accordance
with the rules of universal humour, he still had his hat on.
-- Terry Pratchett, "Lords and Ladies"
--------------------------------------------------------------------------
Anthony's Castle http://www.ict.griffith.edu.au/anthony/

Continue reading on narkive:
Loading...