[HOWTO]Labeling picture (date and costum 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?".
Post Reply
thaysen13
Posts: 8
Joined: 2017-12-26T13:08:47-07:00
Authentication code: 1152

[HOWTO]Labeling picture (date and costum label)

Post by thaysen13 »

Hi
I want to label my pictures.
I have found that with th command identify I know the date the picture was taken.
and with convert you can add labels to you image.
But how can you set the date on the left of a picture and the costum label in the middle.
I have already this as code https://imgur.com/gDXIACV
Please help
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: [HOWTO]Labeling picture (date and costum label)

Post by Bonzo »

What version of Imagemagick are you using - it would probably be simpler with V7?

Posting your code here is easier for somebody to try it rather than working from an image.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: [HOWTO]Labeling picture (date and costum label)

Post by fmw42 »

Create two images from your text with transparent backgrounds using label:. The composite them one at a time using -gravity and -geometry to place them where you want.

Alternately, write the text using -draw or two sets of -annnotate to put the text directly on your image.
thaysen13
Posts: 8
Joined: 2017-12-26T13:08:47-07:00
Authentication code: 1152

Re: [HOWTO]Labeling picture (date and costum label)

Post by thaysen13 »

Can you post an example command how to do it please?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: [HOWTO]Labeling picture (date and costum label)

Post by Bonzo »

You still did not say what version you are using. This will print the date and time on the image ( V7 only ) getting the data from the image:

Code: Select all

magick input.jpg -gravity northwest -annotate +0+0 "%[EXIF:DateTime]" output.jpg
With V6 you would need to read the datetime into a variable first.

Where are you getting your custom data from?

Never mind you did not answer my question or post your code here as requested.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: [HOWTO]Labeling picture (date and costum label)

Post by fmw42 »

Try this

Code: Select all

convert logo: -font Arial -pointsize 24 -fill black \
-gravity southwest -annotate +10+10 "Dec. 26, 2017" \
-gravity south -annotate -50+50 "Custom Text" \
logo_annotate.jpg
thaysen13
Posts: 8
Joined: 2017-12-26T13:08:47-07:00
Authentication code: 1152

Re: [HOWTO]Labeling picture (date and costum label)

Post by thaysen13 »

Thanks guys i am using the imagemagick 6.2 i think
thaysen13
Posts: 8
Joined: 2017-12-26T13:08:47-07:00
Authentication code: 1152

Re: [HOWTO]Labeling picture (date and costum label)

Post by thaysen13 »

I want to make somthing like this but with 2 labels.
http://www.imagemagick.org/Usage/annotating/#annotating (first example)
And all the picture I have are different sizes

Code: Select all

 convert foto3.jpeg -pointsize 12 -background Khaki -fill black -gravity southwest-annotate0 "date" \
 	-gravity south -annotate 0 "costum text" foto3.jpeg
The only thing that isn't working is the background
Last edited by thaysen13 on 2017-12-27T02:54:44-07:00, edited 2 times in total.
thaysen13
Posts: 8
Joined: 2017-12-26T13:08:47-07:00
Authentication code: 1152

Re: [HOWTO]Labeling picture (date and costum label)

Post by thaysen13 »

fmw42 wrote: 2017-12-26T14:25:58-07:00 Create two images from your text with transparent backgrounds using label:. The composite them one at a time using -gravity and -geometry to place them where you want.

Alternately, write the text using -draw or two sets of -annnotate to put the text directly on your image.
Can you give me an example please?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: [HOWTO]Labeling picture (date and costum label)

Post by snibgo »

thaysen13 wrote:The only thing that isn't working is the background
"-background" is relevant for "label:" (which creates a new image), but not for "-annotate" (which modifies an image that already exists).
snibgo's IM pages: im.snibgo.com
thaysen13
Posts: 8
Joined: 2017-12-26T13:08:47-07:00
Authentication code: 1152

Re: [HOWTO]Labeling picture (date and costum label)

Post by thaysen13 »

snibgo wrote: 2017-12-27T05:38:05-07:00
thaysen13 wrote:The only thing that isn't working is the background
"-background" is relevant for "label:" (which creates a new image), but not for "-annotate" (which modifies an image that already exists).
Thanks i am trying to do it with stroke
thaysen13
Posts: 8
Joined: 2017-12-26T13:08:47-07:00
Authentication code: 1152

Re: [HOWTO]Labeling picture (date and costum label)

Post by thaysen13 »

This is what i got:

Code: Select all

convert fotog.jpeg -pointsize 15 -gravity south -background white \
-fill black label: lksdfjfdjsfs  \
 -gravity southwest label: datum -append foto35.jpeg
the result is:
https://imgur.com/Nt33j51

I tried this also

Code: Select all

convert fotog.jpeg -pointsize 15 -gravity south -background white \
-fill black label: lksdfjfdjsfs -append  \
 -gravity southwest label: datum -append foto35.jpeg
that result is this:
https://imgur.com/Hc8DBOY

I want the date left and the costum label in the middle but the problem is that they are not on the same line can anyone help with this?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: [HOWTO]Labeling picture (date and costum label)

Post by snibgo »

After appending the first label, create the second label, but don't append it. Instead, composite it over the image, eg:

Code: Select all

convert toes.png label:Centre  -gravity South -append label:left -gravity southwest -composite out.png
Pease don't start new threads asking a question you have already asked. I've deleted your other threads.
snibgo's IM pages: im.snibgo.com
thaysen13
Posts: 8
Joined: 2017-12-26T13:08:47-07:00
Authentication code: 1152

Re: [HOWTO]Labeling picture (date and costum label)

Post by thaysen13 »

Thanks for the answer I got it know!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: [HOWTO]Labeling picture (date and costum label)

Post by fmw42 »

-annotate uses -undercolor, if you want to put a different color under the text. So you can go back to my original two -annotates, if you want.
Post Reply