Page 1 of 1

Caption is overflowing box

Posted: 2013-05-24T10:03:12-07:00
by johnfl68
Hello:

I thought that if you use caption for text, that it is supposed to word wrap to fit.

Often times I find that words are cut off on the right side (gravity west), and there is plenty of space below for the words to wrap, but they often don't.

I could add in Text::Wrap but I shouldn't have to, if caption is supposed to already do that.

Anyone have any ideas?

Thanks!

John

Re: Caption is overflowing box

Posted: 2013-05-24T11:20:21-07:00
by fmw42
Please supply your IM version and platform and the exact command you used.

Re: Caption is overflowing box

Posted: 2013-05-24T11:40:17-07:00
by johnfl68
Here is the Version information (community server):

Version: ImageMagick 6.7.6-4 2012-09-03 Q16

Linux 3.5.4

Code: Select all

my $image = Image::Magick->new;
$image->Set(background => "transparent", fill => $fontcolor1, gravity => 'west', font=>"$font2", pointsize => 26, size => '325x90');
$image->Read("caption:$currently_summary");
Image is composited to a a larger background with other images and text.

John

Re: Caption is overflowing box

Posted: 2013-05-24T12:05:18-07:00
by fmw42
This works for me in the command line using IM 6.8.5.7 Q16 Mac OSX SnowLeopard. Could it be you are using an old version of IM? Caption and Label have had numerous fixes over time.

convert -size 325x90 -pointsize 26 -gravity west caption:"This is a long test to see if it wraps properly" 1tmp1.png

Image

But you would fill it better if you left off the pointsize.


convert -size 325x90 -gravity west caption:"This is a long test to see if it wraps properly" 1tmp2.png

Image

You might also consider using -trim and then add some border as desired.

Re: Caption is overflowing box

Posted: 2013-05-24T16:56:03-07:00
by johnfl68
Here is what happened earlier today:

Image

The "y" in Cloudy was cut off, instead of wrapping to a new line. The text box starts just below the icon with the windmills, and extends down to just above the Powered by... text at the bottom, so there was plenty of room for the text to wrap, and it has wrapped before correctly with other text variables.

I will check with my webhost about updated ImageMagick/PerlMagick to see if that solves the issues I have been seeing from time to time.

Thanks!

John

Re: Caption is overflowing box

Posted: 2013-05-24T17:22:11-07:00
by fmw42
what was your exact command that created the text image for the part that got cut off. Give me the values and font used and I will check it in the command line on my system