Caption is overflowing box

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
johnfl68
Posts: 33
Joined: 2012-07-09T18:31:26-07:00
Authentication code: 13

Caption is overflowing box

Post by johnfl68 » 2013-05-24T10:03:12-07:00

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

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

Re: Caption is overflowing box

Post by fmw42 » 2013-05-24T11:20:21-07:00

Please supply your IM version and platform and the exact command you used.

johnfl68
Posts: 33
Joined: 2012-07-09T18:31:26-07:00
Authentication code: 13

Re: Caption is overflowing box

Post by johnfl68 » 2013-05-24T11:40:17-07:00

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

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

Re: Caption is overflowing box

Post by fmw42 » 2013-05-24T12:05:18-07:00

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.

johnfl68
Posts: 33
Joined: 2012-07-09T18:31:26-07:00
Authentication code: 13

Re: Caption is overflowing box

Post by johnfl68 » 2013-05-24T16:56:03-07:00

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

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

Re: Caption is overflowing box

Post by fmw42 » 2013-05-24T17:22:11-07:00

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

Post Reply