Page 1 of 1

problems with mogrify or convert -label

Posted: 2016-04-26T20:09:51-07:00
by samiam00
I am very new to this, so please have compassion -- I have, what I thought, was a simple problem. I have a folder full of jpgs that all need the same fixed label. So I figured this command should do the trick:

mogrify -label "Before" -geometry +0+0 -pointsize 200 -background Red -fill White "C:\pic\BEFORE\*.jpg"

but nothing happens - it works like a charm with the montage command, but of course I can only do one picture in the folder. I tried the convert command as well - nothing.

What am I overlooking here?

thanks

Re: problems with mogrify or convert -label

Posted: 2016-04-26T20:26:52-07:00
by GeeMack
samiam00 wrote:What am I overlooking here?
I'm using "ImageMagick 7.0.0-0 Q16 x64 2016-03-26" on Windows 7 64. If I understnad what you're trying to do, you might try constructing your command more like this...

Code: Select all

mogrify -gravity south -fill white -pointsize 24 -annotate +0+20 "Before" "C:\pic\BEFORE\*.jpg"

Re: problems with mogrify or convert -label

Posted: 2016-04-26T20:32:42-07:00
by samiam00
That works, though I am looking for something that looks more like the label outcome - a solid red bar below the picture with the label in it - not with the label over the actual picture. Is there a way to achieve that with your method?

Thanks

Re: problems with mogrify or convert -label

Posted: 2016-04-26T20:42:27-07:00
by fmw42
add padding below the image using -splice before the annotate. See http://www.imagemagick.org/Usage/crop/#splice

Re: problems with mogrify or convert -label

Posted: 2016-04-26T20:43:47-07:00
by GeeMack
samiam00 wrote:That works, though I am looking for something that looks more like the label outcome - a solid red bar below the picture with the label in it - not with the label over the actual picture. Is there a way to achieve that with your method?
You'll have to find the combination of pointsize, the height of the splice, and the geometry of the annotate that does what you want it to, but this would add a strip of red to the bottom of the images, then annotate the word "Before" in white centered a few pixels up from the bottom of all the images.

Code: Select all

mogrify -background red -fill white -pointsize 24 -gravity south -splice 0x32 -annotate +0+4 "Before" "C:\pic\BEFORE\*.jpg"

Re: problems with mogrify or convert -label

Posted: 2016-04-26T21:00:16-07:00
by samiam00
That works - thanks - is there a way to make the font size and the splice a percentage, since all images have vastly different sizes and they all should have a similar 'proportion'. I figured out how to do a percentage on a frame - can that be done for all sizes?

Re: problems with mogrify or convert -label

Posted: 2016-04-26T21:01:09-07:00
by samiam00
and just for my understanding - does the -label command simply not work with mogrify or convert? It shows it as option in the tutorial.

Re: problems with mogrify or convert -label

Posted: 2016-04-26T22:09:25-07:00
by GeeMack
samiam00 wrote:That works - thanks - is there a way to make the font size and the splice a percentage, since all images have vastly different sizes and they all should have a similar 'proportion'. I figured out how to do a percentage on a frame - can that be done for all sizes?
This would get a bit more complicated since you'd have to obtain the dimensions from each image and use those to calculate the splice height and pointsize. You might need to do them in a loop using your command shell's "for" command. The syntax would depend on your OS. There are also various ways to extract and use information from the images depending on which version of IM you're using.

Re: problems with mogrify or convert -label

Posted: 2016-04-26T22:14:04-07:00
by GeeMack
samiam00 wrote:and just for my understanding - does the -label command simply not work with mogrify or convert? It shows it as option in the tutorial.
The "-label" operator doesn't add text upon the image. It embeds a label tag into the image datastream. There are several methods to apply text onto an image, most of which can be found at this link.

Re: problems with mogrify or convert -label

Posted: 2016-04-27T01:20:29-07:00
by snibgo
samiam00 wrote:and just for my understanding -
See the documentation at http://www.imagemagick.org/script/comma ... .php#label

Re: problems with mogrify or convert -label

Posted: 2016-04-27T04:04:08-07:00
by samiam00
GeeMack wrote:
samiam00 wrote:and just for my understanding - does the -label command simply not work with mogrify or convert? It shows it as option in the tutorial.
The "-label" operator doesn't add text upon the image. It embeds a label tag into the image datastream. There are several methods to apply text onto an image, most of which can be found at this link.
OK - thanks - I guess i was mislead by the fact then that -label with the montage command produces exactly the result I was looking for:
montage -label "After" "C:\TIApic\7TOS\*.jpg" -geometry +0+0 -pointsize 200 -background Gold 7TOS.jpg

Re: problems with mogrify or convert -label

Posted: 2016-04-27T04:05:24-07:00
by samiam00
snibgo wrote:
samiam00 wrote:and just for my understanding -
See the documentation at http://www.imagemagick.org/script/comma ... .php#label
Thanks - i did look at all the documentation, before asking. I am not a programmer and could not quite piece things together. Without examples, I am lost....