Caption text with stroke cut off. LATEST build. Solve/hack?

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
oarion7
Posts: 1
Joined: 2012-08-22T18:16:58-07:00
Authentication code: 67789

Caption text with stroke cut off. LATEST build. Solve/hack?

Post by oarion7 » 2012-08-22T18:28:17-07:00

Greetings

Fresh compilation of latest imagemagick source, on Ubuntu Lucid.
convert version: ImageMagick 6.7.9-0 2012-08-22 Q16 http://www.imagemagick.org


I am trying to generate a close-fitting white "cloud" or "speech bubble" closely surrounding/following the shape of generated black text.
The resulting generated image must be word-wrapped (hence "caption" here)
The resulting generate image must fit within a 260px-wide square (hence the specification via "size")

Applying a heavy stroke to text entered via "caption" yields favorable results except that are cut off on the right side. If I generate the black text via caption all by itself, it displays nicely within the dimensions. With both generated together, as below, both the black text and the white cloud text are cut off to the right, as pictured.

What I have:

Code: Select all

convert -background gray  -fill white  -gravity center -font /usr/share/fonts/truetype/msttcorefonts/Comic_Sans_MS_Bold.ttf -pointsize 16 -size 260x -stroke white -strokewidth 25 caption:'Sample writing, text cut off to the right' -background transparent -fill black -stroke none caption:'Sample writing, text cut off to the right' -gravity center -compose over -composite caption.png
Result:
Image

I would appreciate any advice. A hack that requires a couple of commands is fine if necessary. Thanks to anyone who can help!

User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Caption text with stroke cut off. LATEST build. Solve/ha

Post by anthony » 2012-08-22T18:54:27-07:00

Define either pointsize, or image size, not both.
This will make IM resize the missing part to match.

see IM examples, Labeling
http://www.imagemagick.org/Usage/text/#label
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/

User avatar
fmw42
Posts: 25559
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Caption text with stroke cut off. LATEST build. Solve/ha

Post by fmw42 » 2012-08-22T19:00:53-07:00

Anthony, I tried that by removing the pointsize, but that did not help.


Looks like a caption bug. Have you tried Pango: rather than Caption:

See
http://www.imagemagick.org/Usage/text/#pango
http://www.imagemagick.org/script/formats.php#pseudo

Note you have to install PANGO. Then recompile IM.
Last edited by fmw42 on 2012-08-22T19:12:52-07:00, edited 1 time in total.

User avatar
magick
Site Admin
Posts: 11063
Joined: 2003-05-31T11:32:55-07:00

Re: Caption text with stroke cut off. LATEST build. Solve/ha

Post by magick » 2012-08-22T19:07:28-07:00

We can reproduce the problem you posted and have a patch in ImageMagick 6.7.9-1 Beta, available by sometime tomorrow. Thanks,

Post Reply