problems with mogrify or convert -label

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Locked
samiam00
Posts: 10
Joined: 2016-04-26T20:01:22-07:00
Authentication code: 1151

problems with mogrify or convert -label

Post 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

User avatar
GeeMack
Posts: 757
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: problems with mogrify or convert -label

Post 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"

samiam00
Posts: 10
Joined: 2016-04-26T20:01:22-07:00
Authentication code: 1151

Re: problems with mogrify or convert -label

Post 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

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

Re: problems with mogrify or convert -label

Post by fmw42 »

add padding below the image using -splice before the annotate. See http://www.imagemagick.org/Usage/crop/#splice

User avatar
GeeMack
Posts: 757
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: problems with mogrify or convert -label

Post 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"

samiam00
Posts: 10
Joined: 2016-04-26T20:01:22-07:00
Authentication code: 1151

Re: problems with mogrify or convert -label

Post 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?

samiam00
Posts: 10
Joined: 2016-04-26T20:01:22-07:00
Authentication code: 1151

Re: problems with mogrify or convert -label

Post 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.

User avatar
GeeMack
Posts: 757
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: problems with mogrify or convert -label

Post 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.

User avatar
GeeMack
Posts: 757
Joined: 2015-12-01T22:09:46-07:00
Authentication code: 1151
Location: Central Illinois, USA

Re: problems with mogrify or convert -label

Post 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.

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

Re: problems with mogrify or convert -label

Post by snibgo »

samiam00 wrote:and just for my understanding -
See the documentation at http://www.imagemagick.org/script/comma ... .php#label
snibgo's IM pages: im.snibgo.com

samiam00
Posts: 10
Joined: 2016-04-26T20:01:22-07:00
Authentication code: 1151

Re: problems with mogrify or convert -label

Post 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

samiam00
Posts: 10
Joined: 2016-04-26T20:01:22-07:00
Authentication code: 1151

Re: problems with mogrify or convert -label

Post 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....

Locked