[SOLVED] Stretch text to fit text box

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
iltomma
Posts: 4
Joined: 2015-06-29T16:50:39-07:00
Authentication code: 6789

[SOLVED] Stretch text to fit text box

Post by iltomma »

Ciao,
how can I stretch a text to fit in a box both with width and height automatic values?
I use windows command scripts

Thanks
Marco
Last edited by iltomma on 2015-06-30T03:29:57-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Stretch text to fit text box

Post by fmw42 »

iltomma
Posts: 4
Joined: 2015-06-29T16:50:39-07:00
Authentication code: 6789

Re: Stretch text to fit text box

Post by iltomma »

thanks for reply, but with Label and Caption if I use "-size 200x" and I have the text box 200x400, the font change only the widht and not the height.
examples:
my text box is 300x50
my text it "first test"
if I use "-size 300x" the width is automatically stretch to 300 but not for the height
if I use "-size x50" the height is automatically stretch to 50 but the width no, it's shorter

Maybe another possibility is to generate a text image and then resize the image and composite with the background image, but I don't know if the quality is ok

grazie
marco
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Stretch text to fit text box

Post by snibgo »

I don't understand what you want to do.

Perhaps you want to make some text exactly fill a given height and width.

If so, then make the text too large, then resize to exactly those dimensions.
snibgo's IM pages: im.snibgo.com
iltomma
Posts: 4
Joined: 2015-06-29T16:50:39-07:00
Authentication code: 6789

Re: Stretch text to fit text box

Post by iltomma »

Ciao,
I need to stretch both widht and height at the same time, and discard the text aspect ratio
I uploaded a image of what I need
http://imageshack.com/a/img673/2692/fgLwQn.png
thanks

Marco
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Stretch text to fit text box

Post by snibgo »

Code: Select all

convert -pointsize 100 label:"TEXT TO FIT" -trim +repage -resize 200x50! x.png
Is that what you want?
snibgo's IM pages: im.snibgo.com
iltomma
Posts: 4
Joined: 2015-06-29T16:50:39-07:00
Authentication code: 6789

Re: Stretch text to fit text box

Post by iltomma »

yessssss!!!!!

Thankyou very much!!

Marco
Post Reply