Bug with Gravity or Annotate

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
bdaniel
Posts: 3
Joined: 2016-06-16T03:56:04-07:00
Authentication code: 1151

Bug with Gravity or Annotate

Post by bdaniel »

Version: ImageMagick 7.0.1-10 Q16 i686 2016-06-09

One of the ways I use ImageMagick is to put a watermark on my photos on my website. The following command worked fine for a couple of years until a couple of months ago. It is no longer working. I use PHP and call ImageMagick via exec():

/usr/local/bin/convert \"in.jpg\" -strip -quality 80 -resize \"750x750>\" -unsharp 0x1 -fill white -undercolor \"#00000080\" -gravity SouthEast -geometry +10-10 -annotate +0+5 \" (c) bobbystuff.com \" \"out.jpg\"


I wonder if this update is the cause:

2016-05-20 7.0.1-6 Cristy <quetzlzacatenango@image...>
Fixed proper placement of text annotation for east / west gravity.


Thanks,
Bobby
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Bug with Gravity or Annotate

Post by snibgo »

What does "It is no longer working" mean? What goes wrong? Does it set your computer on fire? Some more information might help a diagnosis.

You can upload images to somewhere like dropbox.com and paste the URLs here.
snibgo's IM pages: im.snibgo.com
bdaniel
Posts: 3
Joined: 2016-06-16T03:56:04-07:00
Authentication code: 1151

Re: Bug with Gravity or Annotate

Post by bdaniel »

Sorry,

The other options in the command line work fine. The photo is downsized as requested and looks fine. But I do not get the string " (c) bobbystuff.com " in the lower right corner of the photo. I am running the command on my website. The annotation does not work on my website hosted by Lunarpages. I noticed this stopped working a couple of months ago so I suspect Lunarpages updated their version of ImageMagick. I have an earlier version of ImageMagick on my PC. I use WampServer 2.2 on my PC to execute the same PHP code with the same ImageMagick command. The image is correct on my PC and has the annotation.

I checked the change log for ImageMagick and saw the update for text annotation and thought that might be the cause of the problem. My ImageMagick command string has not changed in over a year. Something is different with the version my hosting company recently updated to.

Here is a link to a photo with my watermark in the lower right corner using -annotate when it was working correctly a month or two ago.

http://bobbystuff.com/AllPhotos/large/0 ... 030198.jpg

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

Re: Bug with Gravity or Annotate

Post by fmw42 »

I do not think you should be setting -geometry +10-10 with -annotate +0+5. It does its own offset. Also a negative value for -geometry would generally push text or whatever more towards or off the image corner.

But there was a bug fixed as you noted. It is possible that something else was changed.

Try a simpler command with actual values:

Code: Select all

convert someimage -fill white -font yourfont -pointsize yourpointsize -gravity SouthEast -annotate +0+5 result.png
Does that work as expected? If not, post your input image and exact command line, so we can check it out.
bdaniel
Posts: 3
Joined: 2016-06-16T03:56:04-07:00
Authentication code: 1151

Re: Bug with Gravity or Annotate

Post by bdaniel »

Hi fmw42,

I tried your example and it worked. I kept playing around and discovered that "-geometry +10-10" was causing the problem. I got my command from a website listing a bunch of examples for doing various things, maybe imagemagick.org, I don't remember. But it worked for a couple of years. The purpose of the -geometry parameter was to enlarge the -undercolor slightly for my watermark. I can live without that if I must.

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

Re: Bug with Gravity or Annotate

Post by fmw42 »

I could be wrong, but I do not see how the geometry offset would affect the size of the undercolor region.
Post Reply