Page 2 of 2

Re: Text of differing sizes in separate lines

Posted: 2016-11-20T20:24:36-07:00
by fmw42
I am still not sure I understand. But for what I think you want, you need to resize each smaller image to stretch the width while holding the height constant. That means a resize with distortion by adding the ! to the size arguments. But then the bottom set(s) will likely be more blurred the smaller the height.

So try this (unix syntax):

Code: Select all

im7 magick \
-background white -bordercolor white -fill green -gravity center \
-size 160x160 -font Arial caption:"AB" -trim \
-set option:ht "%h" \
-border 0x10 -resize "160x%[ht]\!" \
-size 160x120 -font Arial caption:"AW" -trim \
-border 0x10 -resize "160x%[ht]\!" \
-size 160x80 -font Arial caption:"AX"  -trim \
-border 0x10 -resize "160x%[ht]\!" \
-size 160x40 -font Arial caption:"AX"  -trim \
-border 0x10 -resize "160x%[ht]\!" \
-size 160x20 -font Arial caption:"AX"  -trim \
-border 0x10 -resize "160x%[ht]\!" \
-append \
output1.jpg
I am not sure about Windows syntax, but I think it might be:

Code: Select all

im7 magick ^
-background white -bordercolor white -fill green -gravity center ^
-size 160x160 -font Arial caption:"AB" -trim ^
-set option:ht "%h" ^
-border 0x10 -resize "160x%[ht]^!" ^
-size 160x120 -font Arial caption:"AW" -trim ^
-border 0x10 -resize "160x%[ht]^!" ^
-size 160x80 -font Arial caption:"AX"  -trim ^
-border 0x10 -resize "160x%[ht]^!" ^
-size 160x40 -font Arial caption:"AX"  -trim ^
-border 0x10 -resize "160x%[ht]^!" ^
-size 160x20 -font Arial caption:"AX"  -trim ^
-border 0x10 -resize "160x%[ht]^!" ^
-append ^
output1.jpg
If that does not work, then one of the Windows users can probably correct it.

Is that what you want? If so you can control the spacing between rows by the border option by changing the 10 to whatever value you want.

If you are trying to keep the letters undistorted and have more space horizontally between the characters, then right now I do not know how that might be done other than writing each character separately and adjusting manually until it looks correct. See -kerning.

So you would have to create each character as an image, trim, pad and append horizontally with space between. See +smush.

Or create a blank image of width you desire and use -gravity east/west to composite the character images on the right/left and then trim and pad the height, then -append each row image

Re: Text of differing sizes in separate lines

Posted: 2016-11-20T21:35:34-07:00
by alpha34
Thank you!! I will try all of your suggestions and see what works. For some reason, when I try to resize with distortion (by adding !), I do see lot of blurring (as expected), the width increases to the value specified but the height of the image after resizing is always greater than the (emphatic) height specified.

Re: Text of differing sizes in separate lines

Posted: 2016-11-20T22:02:50-07:00
by fmw42
My mistake. My code above is wrong. Try this:

Unix:

Code: Select all

im7 magick -respect-parenthesis \
-background white -bordercolor white -fill green -gravity center \
\( -size 160x160 -font Arial caption:"AB" -trim \
-set option:ht1 "%h" -resize "160x%[ht1]\!" -border 0x10 \) \
\( -size 160x120 -font Arial caption:"AB" -trim \
-set option:ht2 "%h" -resize "160x%[ht2]\!" -border 0x10 \) \
\( -size 160x80 -font Arial caption:"AB" -trim \
-set option:ht3 "%h" -resize "160x%[ht3]\!" -border 0x10 \) \
\( -size 160x40 -font Arial caption:"AB" -trim \
-set option:ht4 "%h" -resize "160x%[ht4]\!" -border 0x10 \) \
\( -size 160x20 -font Arial caption:"AB" -trim \
-set option:ht5 "%h" -resize "160x%[ht5]\!" -border 0x10 \) \
-append \
output1.jpg
Windows:

Code: Select all

im7 magick -respect-parenthesis ^
-background white -bordercolor white -fill green -gravity center ^
( -size 160x160 -font Arial caption:"AB" -trim ^
-set option:ht1 "%h" -resize "160x%[ht1]^!" -border 0x10 ) ^
( -size 160x120 -font Arial caption:"AB" -trim ^
-set option:ht2 "%h" -resize "160x%[ht2]^!" -border 0x10 ) ^
( -size 160x80 -font Arial caption:"AB" -trim ^
-set option:ht3 "%h" -resize "160x%[ht3]^!" -border 0x10 ) ^
( -size 160x40 -font Arial caption:"AB" -trim ^
-set option:ht4 "%h" -resize "160x%[ht4]^!" -border 0x10 ) ^
( -size 160x20 -font Arial caption:"AB" -trim ^
-set option:ht5 "%h" -resize "160x%[ht5]^!" -border 0x10 ) ^
-append ^
output1.jpg

Re: Text of differing sizes in separate lines

Posted: 2016-11-22T15:50:11-07:00
by alpha34
Thanks a ton!! That worked.

The only change required in your windows script is to use a %% instead of a %

( -size 160x3689 -fill DarkBlue -font Consolas caption:"YI" -trim -set option:ht2 "%%h" -resize 160x%%[ht2]! ) ^