$ sign on text not rendering if followed by numbers

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
javismiles
Posts: 180
Joined: 2010-11-27T01:42:06-07:00
Authentication code: 8675308

$ sign on text not rendering if followed by numbers

Post by javismiles »

hi, i have noticed that if in a text i have the $ sign followed by a number it doesn't render,
anybody else with this problem? what should i do if i need to render something like $15 , $10 in text?
if $ is by itself is not prob, prob happens if its followed by numbers
thanks a lot
Jav
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: $ sign on text not rendering if followed by numbers

Post by fmw42 »

try escaping the $. on unix \$ not sure about windows. or put quotes about the string

see
http://www.imagemagick.org/Usage/text/#escape_chars

perhaps see if anything about that on Windows at http://www.imagemagick.org/Usage/windows/
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: $ sign on text not rendering if followed by numbers

Post by snibgo »

I suspect a Unix escape issue. No problem in Windows, eg:

convert logo: -gravity south -annotate 0 $1billion t.png
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: $ sign on text not rendering if followed by numbers

Post by fmw42 »

javismiles wrote:hi, i have noticed that if in a text i have the $ sign followed by a number it doesn't render,
anybody else with this problem? what should i do if i need to render something like $15 , $10 in text?
if $ is by itself is not prob, prob happens if its followed by numbers
thanks a lot
Jav
What is the exact command line? Are you talking about $ in the text string you want to add or $ in the input filename or $ in the output filename?

What version of IM? What platform?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: $ sign on text not rendering if followed by numbers

Post by anthony »

snibgo wrote:I suspect a Unix escape issue. No problem in Windows, eg:

convert logo: -gravity south -annotate 0 $1billion t.png

$1 outside of single quotes is a shell variable substitution. As that variable is probably not defined it gets replaced by a empty string by the shell. In a script $1 is the first argument given to teh shell script. This is not a IM problem but a Shell problem (CLI) problem.

a $ on its own (followed by a space) is not reconised as a variable by the shell so the shell leaves it alone.

Example ('#' is the CLI shell prompt')

Code: Select all

  # echo $123
  23
  # echo $
  $
  # echo $something

  #
DOS often uses % instead of $ for its variable substitutions so the problem does not appear there.

In summery use single quotes or a backslash.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply