Page 1 of 1
I can't overlay text on an image
Posted: 2009-07-15T07:51:26-07:00
by JimKerr
Hi,
I want to overlay some text on an image and I wanted to use ImageMagick's annotate to do this.
On the first try to use this command, I got several errors about missing gs (Ghostscript).
I installed Ghostscript, but when I try to use annotate now, I get another error saying something like:
/usr/bin/convert: line 7: 11455 Bus error "$MAGICK_HOME/bin/$tool" "$@"
I'm using Mac OS/X, and I'm not used to Mac very much, so I'm not very good at working with Terminal and the commandline.
Could somebody please help me to fix this problem, so that I can use ImageMagick's annotate? Thanks!
Re: I can't overlay text on an image
Posted: 2009-07-17T03:38:54-07:00
by anthony
Rather than relying of Ghostscript, use -font to specify a TTF file for the font.
Re: I can't overlay text on an image
Posted: 2009-07-18T01:57:28-07:00
by JimKerr
I specified the font and now it works.
Now I have another question. I want to write a list of prices on to a paper-like image.
What is the best way to write these prices under each other to the image?
Is there a way for -annotate to automatically write the next price in a new line with some spacing between?
And can it all be done in one annotate action or should there be more actions after each other to build the final image?
Re: I can't overlay text on an image
Posted: 2009-07-18T03:04:20-07:00
by Bonzo
You can try using a text file with the prices in.
prices.txt
Code: Select all
convert background.jpg -annotate +0+0 @prices.txt output.jpg
Untested code ! You may not display the £ character and you might need to put the @prices.txt in ' ' e.g. '@prices.txt '
http://www.imagemagick.org/script/comma ... p#annotate
Re: I can't overlay text on an image
Posted: 2009-07-18T05:54:37-07:00
by anthony
The separate between the start points for each line is based on the fonts pointsize, at the current density. That is the offical meaning of 'pointsize'
For 72 dpi density (the default in IM) then pointsize is in pixels! so the start of each line is 'pointsize' pixels below the previous. That is for 12 point add 12 to the Y value!
See IM examples,
Resolution, Pointsize, and Actual Font Size
http://www.imagemagick.org/Usage/text/#pointsize
Re: I can't overlay text on an image
Posted: 2009-07-20T01:28:57-07:00
by JimKerr
The prices and the currency symbol are displayed, but now I want another font and this new font is not showing any text at all.
First I used the Arial font and specified it with -font Arial.ttf This worked well and all of the prices were showing correctly on the image.
Now I want to use this other font, and I have the ttf files for it, but when I try to use it nothing is showed on the image.
What could be the problem?
Re: I can't overlay text on an image
Posted: 2009-07-20T06:14:24-07:00
by Bonzo
Imagemagick should find the fonts on your computer; try this to see what is regestered:
Code: Select all
convert -list font
OR
convert -list type
Depending on you version one will work and the other will not.
With -font try using the full path to your font.
Re: I can't overlay text on an image
Posted: 2009-07-20T06:50:14-07:00
by JimKerr
the convert -list font command gives no output. The -list type command gives a list of color related terms.
The path should be correct, because the Arial.ttf and the other ttf are in the same folder.
I haven't tried any other fonts yet, but could it be that it's just the other font's ttf file that isn't recognized properly by IM, or something like that?
Re: I can't overlay text on an image
Posted: 2009-07-20T11:21:24-07:00
by Bonzo
What version are you using ?
If convert -list font does not return anything that may be your problem.
Re: I can't overlay text on an image
Posted: 2009-07-20T23:32:58-07:00
by JimKerr
I'm using IM 6.5.3-1 on Mac OS X.
Re: I can't overlay text on an image
Posted: 2009-07-21T06:17:59-07:00
by fmw42
Sounds like IM is not installed properly. Are you on Tiger or Leopard? Did you install manually or with MacPorts or Fink or from the binary?
You might want to review my notes/experience at:
viewtopic.php?f=1&t=10442