Page 1 of 1

Bug with Gravity or Annotate

Posted: 2016-06-16T04:00:49-07:00
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

Re: Bug with Gravity or Annotate

Posted: 2016-06-16T04:33:23-07:00
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.

Re: Bug with Gravity or Annotate

Posted: 2016-06-16T05:37:02-07:00
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

Re: Bug with Gravity or Annotate

Posted: 2016-06-16T09:22:58-07:00
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.

Re: Bug with Gravity or Annotate

Posted: 2016-06-17T05:38:53-07:00
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

Re: Bug with Gravity or Annotate

Posted: 2016-06-17T09:38:16-07:00
by fmw42
I could be wrong, but I do not see how the geometry offset would affect the size of the undercolor region.