Imagemagick change label font

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
utbl
Posts: 18
Joined: 2016-09-22T01:53:33-07:00
Authentication code: 1151

Imagemagick change label font

Post by utbl »

Is it possible to change the font of a label?

I have following command:

Code: Select all

convert -background none -bordercolor none -gravity west -fill white img1.png label:"1" -border 0x5 +swap -append label:"Kapitel 1" -border 0x5 -append -write miff:- +delete img2.png label:"2" -border 0x5 +swap -append label:"Kapitel 2" -border 0x5 -append -write miff:- +delete img3.png label:"3" -border 0x5 +swap -append label:"Kapitel 3" -border 0x5 -append -write miff:- +delete img4.png label:"4" -border 0x5 +swap -append label:"Kapitel 4" -border 0x5 -append -write miff:- +delete img5.png label:"5" -border 0x5 +swap -append label:"Kapitel 5" -border 0x5 -append miff:- | montage -set label "" miff:- -tile 3x2 -geometry +15-10 -background none result

which creates me an image with 5 image, each image has a text above and under.

I tried following:

Code: Select all

convert -background none -bordercolor none -gravity west -fill white img1.png label:"1" -border 0x5 +swap -append -font 'Candice' label:"Kapitel 1" -border 0x5 -append -write miff:- +delete img2.png label:"2" -border 0x5 +swap -append label:"Kapitel 2" -border 0x5 -append -write miff:- +delete img3.png label:"3" -border 0x5 +swap -append label:"Kapitel 3" -border 0x5 -append -write miff:- +delete img4.png label:"4" -border 0x5 +swap -append label:"Kapitel 4" -border 0x5 -append -write miff:- +delete img5.png label:"5" -border 0x5 +swap -append label:"Kapitel 5" -border 0x5 -append miff:- | montage -set label "" miff:- -tile 3x2 -geometry +15-10 -background none result
Which created me this error in my command line:

convert.exe: unable to read font `'Candice'' @ warning/annotate.c/RenderType/917.

Another question is that my label look bold how can I make them look "normal".(Maybe it is due to the default font)
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Imagemagick change label font

Post by GeeMack »

utbl wrote:Is it possible to change the font of a label? [...] Another question is that my label look bold how can I make them look "normal".(Maybe it is due to the default font)
You can find out which fonts you have installed and available to use in ImageMagick by entering this command at your shell/command prompt...

Code: Select all

convert -list font
You can learn more about changing font attributes at these links: -pointsize, -weight, -style.
utbl
Posts: 18
Joined: 2016-09-22T01:53:33-07:00
Authentication code: 1151

Re: Imagemagick change label font

Post by utbl »

Hi GeeMack I already know that, sorry I forgot to mention that,

if I convert -list font

I does show me the Helvetiva which I want to use, but it still does not work properly.

Does the command work an your system?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Imagemagick change label font

Post by snibgo »

-font 'Candice'
Why do you have quotes? Why are they single quotes?
snibgo's IM pages: im.snibgo.com
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Imagemagick change label font

Post by GeeMack »

utbl wrote:I does show me the Helvetiva which I want to use, but it still does not work properly. [...] Does the command work an your system?
When I try your command using IM 6.9.6 on Windows I get a warning about the font because it's surrounded by single quotes. Since IM doesn't recognize that as an available font, it falls back to whatever it uses as its default font. The command works without warnings if I put double quotes around the font name. It works just as well with no quote marks around the font name as long as there are no spaces or special characters in it.
utbl
Posts: 18
Joined: 2016-09-22T01:53:33-07:00
Authentication code: 1151

Re: Imagemagick change label font

Post by utbl »

Thanks for your post, I tried the command now without quotes and with double quoates but it still looks the same, could you post your image which you created with the command. I am just wondering.
utbl
Posts: 18
Joined: 2016-09-22T01:53:33-07:00
Authentication code: 1151

Re: Imagemagick change label font

Post by utbl »

I think the correct term would be Squashed the text
User avatar
GeeMack
Posts: 718
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: Imagemagick change label font

Post by GeeMack »

utbl wrote:Thanks for your post, I tried the command now without quotes and with double quoates but it still looks the same, could you post your image which you created with the command. I am just wondering.
No, it's not really helpful if I post results of a command that works for me. You should post the image that you think has a problem, describe the problem in detail, and maybe even upload the actual font file you're working with. Post the exact errors or warning messages if there are any, and explain what you mean by "squashed" and "looks the same" and "does not work properly". Also let us know which version of ImageMagick you're using and which version of what platform, OS, or shell you're trying to run it on.
Post Reply