Caption fails to auto-fit in latest v7

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Bighead
Posts: 11
Joined: 2015-03-09T23:45:55-07:00
Authentication code: 6789

Caption fails to auto-fit in latest v7

Post by Bighead »

I have a powershell script that uses the name of the file as a watermark over the image. First I generate a caption then use composite to place it over the image. The problem is "caption" is no longer expanding to a new line in the latest ImageMagick-7.0.3-7-Q16-x64-dll.

The full name of the image is this:
tex1_124x40_3a277be1b9da51b7_2d0d8f84dc3ccc36_8

But this is the result:
Image

Using ImageMagick-7.0.1-6-Q16-x64-dll there is no problem.
Image

And this is the full command I'm using in PowerShell.

Code: Select all

& $Convert -background transparent -fill $FontColor -undercolor $BGColor -font $FontFace -pointsize $FontSize -size $CaptionWidth -gravity Center caption:$Watermark $CaptionPath
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Caption fails to auto-fit in latest v7

Post by fmw42 »

It usually helps more if you give an example that the IM developer can use that has actual values in it.
Bighead
Posts: 11
Joined: 2015-03-09T23:45:55-07:00
Authentication code: 6789

Re: Caption fails to auto-fit in latest v7

Post by Bighead »

Sure, all of the variables would loosely translate into this:

Code: Select all

magick.exe -background transparent -fill #FF0000 -undercolor #00FF00 -font Courier-New-Bold -pointsize 8 -size 496x -gravity Center caption:tex1_124x40_3a277be1b9da51b7_2d0d8f84dc3ccc36_8 C:\Users\Bighead\AppData\Local\Temp\CTT-PS_Temp\TempWatermark\cap.png
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Caption fails to auto-fit in latest v7

Post by fmw42 »

That command gives me a very small image (496x10) with no line breaks on IM 7.0.3-7 and IM 6.9.6.5 on Mac OSX. Are you sure that is correct?

Code: Select all

magick -background transparent -fill "#FF0000" -undercolor "#00FF00" \
-font Courier-New-Bold -pointsize 8 -size "496x" -gravity Center \
caption:"tex1_124x40_3a277be1b9da51b7_2d0d8f84dc3ccc36_8" \
cap.png
Bighead
Posts: 11
Joined: 2015-03-09T23:45:55-07:00
Authentication code: 6789

Re: Caption fails to auto-fit in latest v7

Post by Bighead »

I actually did make a mistake, I forgot that $FontSize is actually calculated differently so 8 is incorrect for pointsize. Reusing your example it should be....

Code: Select all

magick -background transparent -fill "#FF0000" -undercolor "#00FF00" \
-font Courier-New-Bold -pointsize 39 -size "496x" -gravity Center \
caption:"tex1_124x40_3a277be1b9da51b7_2d0d8f84dc3ccc36_8" \
cap.png
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Caption fails to auto-fit in latest v7

Post by magick »

Thanks for the problem report. We can reproduce it and will have a patch to fix it in GIT master branch @ https://github.com/ImageMagick/ImageMagick later today. The patch will be available in the beta releases of ImageMagick @ http://www.imagemagick.org/download/beta/ by sometime tomorrow.
Bighead
Posts: 11
Joined: 2015-03-09T23:45:55-07:00
Authentication code: 6789

Re: Caption fails to auto-fit in latest v7

Post by Bighead »

I never did get to try the beta version with the patch, but I just wanted to point out this is still an issue in the latest version (ImageMagick 7.0.4-5).
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Caption fails to auto-fit in latest v7

Post by magick »

It looks like the patch did not get pushed to the repository. This oversite is fixed. Look for the patch tomorrow in the beta release of IM 7.0.4-6.
Post Reply