Page 1 of 1

Textured text on fixed width & height canvas

Posted: 2017-02-21T02:11:04-07:00
by robocop
Hello folks :o

I'm trying to create caption text with a textured background used for the text.

I followed the directions here for the Psychedelic! sample:
http://www.imagemagick.org/Usage/text/#annotate_size

However, what i was hoping to accomplish was to create textured text on a fixed canvas width X height so the text would auto resize & center without having to add -pointsize for the caption.

Here is a 600x600 pixel canvas example of what i hope to accomplish.

Texture image
Image

Caption text: WOW this is awesome

The output would be something like this.
Image

Could this be done ? I hope it's possible to accomplish this with imagemagick :D

Version: ImageMagick 6.7.7-10 2016-11-29 Q16 on Ubuntu

Thanks so much for any help and pointing me in the right direction.

Re: Textured text on fixed width & height canvas

Posted: 2017-02-21T09:02:09-07:00
by snibgo
v6.7.7 is very old. I suggest you upgrade.

Windows BAT syntax:

Code: Select all

%IM%convert ^
  texture2.jpg ^
  ( -clone 0 -fill White -colorize 100 ) ^
  ( -size 600x600 -gravity center -fill Black ^
    caption:"WOW\nthis is\nawesome" ) ^
  -composite ^
  w.png
For bash, escape the parentheses to \( and \), and change lines-ends from ^ to \.

Re: Textured text on fixed width & height canvas

Posted: 2017-02-22T04:32:36-07:00
by robocop
snibgo wrote: 2017-02-21T09:02:09-07:00 v6.7.7 is very old. I suggest you upgrade.

Windows BAT syntax:

Code: Select all

%IM%convert ^
  texture2.jpg ^
  ( -clone 0 -fill White -colorize 100 ) ^
  ( -size 600x600 -gravity center -fill Black ^
    caption:"WOW\nthis is\nawesome" ) ^
  -composite ^
  w.png
For bash, escape the parentheses to \( and \), and change lines-ends from ^ to \.

Thank you so much snibo. It works very well.

I'm just having 1 small final issue. I am using a lot of calligraphy style fonts and the caption in many cases extends beyond the bounding box.

I've looked everywhere and haven't had much luck in solving this.

I've attached an example using the Marguaritas font:
http://www.dafont.com/marguaritas.font
Image

If there was a way to add some padding to the edges, it would be great though.

I will upgrade my version as you advised. Thanks very much.

Re: Textured text on fixed width & height canvas

Posted: 2017-02-22T07:16:17-07:00
by snibgo
IM's automatic calculation of the pointzize doesn't work on that font. An upgrade may cure the problem. If it doesn't, you can do an automatic pointsize and find what IM has used, then use (say) 90% of that pointsize, or a larger image size.

Re: Textured text on fixed width & height canvas

Posted: 2017-02-27T01:30:30-07:00
by robocop
Hi snibgo

Thank you so much for your advise and help! We basically changed the font and all is great. Many Thanks again :)