I using convert in a shell (bash) script to create picture labels
the command I use in the script is
convert -background white -fill black -font DejaVu-Sans-Book -size 415x47 label:$NAME ./Images/NAME.jpg
If $NAME contains "Boer" then the line works correct.
If $NAME contains " Christabell Sunday" i get the following error messages
convert: unable to open image `Sunday': @ error/blob.c/OpenBlob/2498.
convert: no decode delegate for this image format `Sunday' @ error/constitute.c/ReadImage/532.
So I guess the question is how do I in a script generate a label texst from a variable with space's in it.
use convert in script to create piclture abels with a space
Re: use convert in script to create piclture abels with a sp
Add quotes around the label: command line argument.
Re: use convert in script to create piclture abels with a sp
Magick thanks for you quick responce.
I have tried
convert -background white -fill black -font DejaVu-Sans-Book -size 415x47 label:"$NAME" ./Images/NAME.jpg
and
convert -background white -fill black -font DejaVu-Sans-Book -size 415x47 label:'$NAME' ./Images/NAME.jpg
but both give me the same error message.
I have tried
convert -background white -fill black -font DejaVu-Sans-Book -size 415x47 label:"$NAME" ./Images/NAME.jpg
and
convert -background white -fill black -font DejaVu-Sans-Book -size 415x47 label:'$NAME' ./Images/NAME.jpg
but both give me the same error message.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: use convert in script to create piclture abels with a sp
what version of IM are you using and what platform? have you tried the command in command line mode outside your script? the double quotes should work fine. Single quotes won't resolve the variable. did you put quotes in your variable definition? NAME="Christabell Sunday"
This works perfectly fine for me on IM 6.7.2.2 Q16 Mac OSX Tiger.
NAME="Christabell Sunday"
convert -background white -fill black -font Arial -size 415x47 label:"$NAME" tmp1.png
Though the text is left justified. So you might want to add -gravity center. Or just specify only a width or only a height and let label: make the image just fill the text.
This works perfectly fine for me on IM 6.7.2.2 Q16 Mac OSX Tiger.
NAME="Christabell Sunday"
convert -background white -fill black -font Arial -size 415x47 label:"$NAME" tmp1.png
Though the text is left justified. So you might want to add -gravity center. Or just specify only a width or only a height and let label: make the image just fill the text.
Re: use convert in script to create piclture abels with a sp
shame on me.
I had the $NAME at two places in the script and only changed 1 to have the quotes.
Problem solved thx
I had the $NAME at two places in the script and only changed 1 to have the quotes.
Problem solved thx