Caption is wrapping a word with no spaces or linebreaks!

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
alasdairdf
Posts: 53
Joined: 2012-05-15T04:56:50-07:00
Authentication code: 13

Caption is wrapping a word with no spaces or linebreaks!

Post by alasdairdf »

I'm using caption to create titles of a particular size, like this:

Code: Select all

convert -background transparent -colorspace RGB -font "smallcaps.otf" +pointsize -size 1335x806 -gravity center -fill "rgb(28,22,17)" caption:"Calculus" -trim test.jpg
The word "Calculus" here is split to that the s is on the next line, which is very annoying.

How can I fix this?

I'm using CentOS 6.2 64bit and the ImageMagick version is 6.5.4.7-6.el6_2. I have tried to upgrade ImageMagick from source but get an error, I had no problem installing ImageMagick from source on CentOS 5, but I have never managed to install it from source on CentOS 6 due to errors during build, hence the use of the standard rpm.

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

Re: Caption is wrapping a word with no spaces or linebreaks!

Post by fmw42 »

First, jpg does not support transparency, so your result would look totally black because your fill color is nearly black.

Second, you don't need +pointsize. There is no default pointsize, so unless you specify it, it will be off. (Should not hurt though).

Third, if you specify -colorspace RGB in current releases it will be linear colors and not sRGB colors. By default the colors will be sRGB if you leave off the -colorspace. This started about IM 6.7.5.5.

What I run

convert -background white -font candice \
-size 1335x806 -gravity center -fill "rgb(28,22,17)" caption:"Calculus" -trim +repage 1test.jpg

I get it all in one line. Note the +repage is not needed for jpg, but would be needed for gif or png to remove the virtual-canvas.
See http://www.imagemagick.org/Usage/crop/#crop_repage

So your problem is either a bug in your version of IM or with the font you selected. Try upgrading your IM.

Hope this helps.
alasdairdf
Posts: 53
Joined: 2012-05-15T04:56:50-07:00
Authentication code: 13

Re: Caption is wrapping a word with no spaces or linebreaks!

Post by alasdairdf »

I managed to get the latest version of IM to compile, and it works fine now. Thanks!
Post Reply