grasshopper
grasshopper

Reputation: 1401

Custom fonts with imagemagick

I'm trying to find out the capabilities and limitations of what i can actually do with imagemagick and would like to get some feedback on this.

What I ultimately want to do is use imagemagick to output images to the browser with custom ttf fonts in it, so that the user enters some text and it displays all the various images with the different fonts.

What are the limitations of imagemagick, can i specify the location of where to draw the fonts on the image, and will it display differently on different systems or browsers?

I will appreciate it if you can include anything else that I need to know about working with imagemagick, before i jump into this little project.

Upvotes: 3

Views: 9427

Answers (3)

random-forest-cat
random-forest-cat

Reputation: 36004

Another useful command is convert -list font which will list the system fonts, their paths, and aliases. Very useful when porting scripts from one machine to another

convert -list font|grep -i arial
  Font: Arial
    family: Arial
    glyphs: /Library/Fonts/Arial.ttf
  Font: ArialB
    family: Arial
    glyphs: /Library/Fonts/Arial Bold.ttf
  Font: ArialBI
    family: Arial
    glyphs: /Library/Fonts/Arial Bold Italic.ttf
  Font: ArialBk
    family: Arial Black
    glyphs: /Library/Fonts/Arial Black.ttf

This makes it really easy to do things like bold or italicize with imagemagick.

convert -background none  -fill black  -font ArialB -pointsize 15 \
          -size 380x caption:'i <3 stackoverflow' \
          summary_text.png

Upvotes: 1

Matthieu
Matthieu

Reputation: 16417

You can definitely tell imagemagick the location of your text in the image and since it is generated on your server, it will be the same on any browser. The problem may be more how you are displaying those images (any css or javascript tricks ?)

The thing is that all those fonts will need to be installed on your server where the image is going to be created.

Check this about converting text to images: http://www.imagemagick.org/Usage/text/

Upvotes: 1

interskh
interskh

Reputation: 2591

You should check imagemagick example page: http://www.imagemagick.org/Usage/

It is really powerful and there are so many you can do.

And yes, you can specify font convert -t a.ttf ...

Upvotes: 2

Related Questions