Page 1 of 1

Label pictures

Posted: 2015-01-29T12:14:16-07:00
by sebtux
Hi,

I would like to label lots of photographs for a website as NatGeo does with some of their shots (ie http://2.bp.blogspot.com/-4mxYjp-CyUE/U ... 712187.jpg) Just the text part at the bottom-right, not the logo.

As far as I understood ImageMagick's power, it would be enough to determine the width of the images, create a semi-transparent rectangle and Annotate some text over it with "gm compose..."

My doubts are:
a- Is it possible to create a semi-transparent rectangle that fits exactly the size of the text? Should I create an image with the text first?
b- Is it possible to align it to the bottom-right (southeast) of the image?

TIA. -Seb

Re: Label pictures

Posted: 2015-01-29T12:43:44-07:00
by fmw42
gm compose...
That is a GraphicsMagick command? This is not GraphicsMagick forum, it is Imagemagick.

Nevertheless, all what you ask is possible. You would create the text on a semi-transparent background using convert ... label:"yourtext" and then composite it over the image using -gravity to set to the desired corner.

Something like (unix syntax)
( for windows remove the \ before the parens)

convert backgroundimage \( -backgroundcolor "rgba(255,0,0,0.5)" -pointsize 18 -font arial label:"yourtext" \) -gravity southeast -compose over -composite resultimage

see
http://www.imagemagick.org/Usage/text/#label
http://www.imagemagick.org/script/color.php
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/layers/#convert
http://www.imagemagick.org/Usage/compose/
http://www.imagemagick.org/script/comma ... hp#gravity

Always a good idea to provide your IM version and platform!

Re: Label pictures

Posted: 2015-01-29T12:56:29-07:00
by sebtux
Thanks a lot, yes, I'm using Linux, a little overhelmed and confused for the tons of options and by mistake have replaced imagemagick with graphicsmagick... that didn't helped I suppose. Now have installed ImageMagick 6.6.7. Thanks again.

Re: Label pictures

Posted: 2015-01-29T13:13:10-07:00
by fmw42
IM 6.6.7 is quite old (over 200 versions). You would be best to upgrade if you can.