Page 1 of 1

2 fonts in one line text

Posted: 2013-10-16T09:13:10-07:00
by gmconsult
Is there a way to do that without using 2 x the coordinates.

Code: Select all

convert tmp.png -gravity SouthWest -font ./ZZZ_FONTS/trademarkerweb.ttf -pointsize 14 -fill '#000000FF' -annotate 0x0+2+2 "42.5" \
	-font ./ZZZ_FONTS/meta_plus_bold_italic.ttf -pointsize 9 -fill '#000000FF' -annotate 0x0+40+5 "g" \
	...
My problem is that I want do it with only setting once the coordinates. The numbers in front can change and I would like to create a view hundred pictures without changing that 2nd coordinates...

Re: 2 fonts in one line text

Posted: 2013-10-16T10:08:29-07:00
by fmw42
If I understand correctly, I do not believe there is a way to do that with -annotate, but I believe you might be able to do it with -draw.

These two produce the same results.


convert -size 100x100 xc:lightblue -gravity Center \
-font arial -pointsize 14 -fill '#000000FF' -annotate 0x0+2+2 "42.5" \
-font verdana -pointsize 9 -fill '#000000FF' -annotate 0x0+40+5 "g" 1tmp.png


convert -size 100x100 xc:lightblue -gravity Center \
-draw "font arial fill '#000000FF' font-size 14 text 2,2 '42.5' \
font verdana fill '#000000FF' font-size 9 text 40,5 'g'" 2tmp.png

Re: 2 fonts in one line text

Posted: 2013-10-16T10:35:39-07:00
by gmconsult
i know that...
but

text 2,2 is fix and then comes a variable long text... e.g. '42.5'
text 40,5 'g' ... has in each of the 3.800 pictures another position...

So I need to find a way where i can continue writing and just change the font and the font-size or i must find out the coordinates of each 2nd text for each of that 3.800 images... And that would be for me a huge problem...

Re: 2 fonts in one line text

Posted: 2013-10-16T11:23:39-07:00
by fmw42
gmconsult wrote:i know that...
but

text 2,2 is fix and then comes a variable long text... e.g. '42.5'
text 40,5 'g' ... has in each of the 3.800 pictures another position...

So I need to find a way where i can continue writing and just change the font and the font-size or i must find out the coordinates of each 2nd text for each of that 3.800 images... And that would be for me a huge problem...

Sorry I do not understand what you want. You must specify in some way each coordinate for the second part of the text for each of your images. I do not know how you can do that without measuring where each one would be located.

Perhaps I am not understanding your issue. I thought it was just an issue of using two -annotates rather than one command such as -draw with multple locations for text.

If that is not the case, then please explain further.

Re: 2 fonts in one line text

Posted: 2013-10-16T11:49:28-07:00
by gmconsult
I need to write in top op tmp.png in the lower left corner some text in font A and then some small text in font B

I have arround 40 Standard-Images in wich in must write some text and save them. The text has at least 2 parts sometimes 3 parts. I need a way to make one textbox write there something, change the font and the fill-color and continue writing in the same position!

If i need to figure out all coordiantes of all text-parts I can do it as well in Photoshop or Gimp.

The point is that I need a way to write there in one line 2-3 text-parts in 2-3 colors and 2 font-sizes all based on the left lower corner.

e.g.:
90g - gloss - vanish
115g - silk - UV vanish
45.5g - vanish
900ยต - transparent

But i really need to place sings like that inklusive that format and that different colors on a image and that always on the coordinates 2,2 from the lower left corner

Re: 2 fonts in one line text

Posted: 2013-10-16T12:38:34-07:00
by fmw42
Can you make an example and point out what exactly you want done.

As far as I understand, your example and my example using -draw do what you seem to want, namely, one line of code with one -draw that fills in all the different sections of text all relative to one locations.

You can use -gravity southwest and translate with -draw to set the base location of all the fonts and then specify the offsets which will be relative to the 2,2 from the bottom left corner.

For example, here I use -gravity Southwest and translate 10,10 (rather than 2,2)

convert -size 100x100 xc:lightblue -gravity Southwest \
-draw "translate 10,10 font arial fill '#000000FF' font-size 14 text 0,0 '42.5' \
font verdana fill '#000000FF' font-size 9 text 40,5 'g'" 2tmp.png

If this is not what you want, then please provide an example and explain relative to the example.

Re: 2 fonts in one line text

Posted: 2013-10-16T13:42:13-07:00
by snibgo
I think gmconsult doesn't want to specify offsets.

Pango may be a better choice. See http://www.imagemagick.org/Usage/text/#pango

Or build images of each string, then append them, eg:

Code: Select all

convert -pointsize 14 label:42.5 label:g +append t.png