Page 2 of 2

Re: Annotating photos with metadata

Posted: 2017-04-04T21:19:12-07:00
by schievelbein
Here is some clarification.
I am trying to write a script to run after I scan each image and put the meta-data into THOUSANDS of photos I am scanning.
When I right click on an image, and select Annotate, it runs my script Annotate with the filename as the parameter.
Here is my script that I currently run, that has to be edited for every single file:

Code: Select all

convert "input.jpg" \( -clone 0 -size 1200 -delete 0 -background black -gravity center -pointsize 20 -fill White caption:"This is a the meta-comment that is pulled from the photo and I do not want to have to cut and paste for every photo" -trim \) -append "annotated.jpg"
and here is how I would like to make the script general, but I cannot get the parameters to work:

Code: Select all

read cw cf cdesc <<< $( identify -format "%w %[fx:h*.04] %[IPTC:2:120]" $1 )
convert $1 \( -clone 0 -size $cs -delete 0 -background black -gravity center -pointsize $cf -fill White caption:$cdesc -trim \) -append $1_annotated.jpg

Re: Annotating photos with metadata

Posted: 2017-04-04T21:57:05-07:00
by schievelbein
Thank you again for all of the help from everybody.
Here is the final code with only one little issue.
I wish that I could put a blank line before the text so I could crop the text off later if I wanted.
The way it is now, some of the text overlays the photo.

Code: Select all

read cw cf cdesc <<< $( identify -format "%w %[fx:h*.03] %[IPTC:2:120]" $1 )
convert $1 \( -clone 0 -size $cw -delete 0 -background black -gravity center -pointsize $cf -fill White caption:"$cdesc" -trim \) -append $1_annotated.jpg

Re: Annotating photos with metadata

Posted: 2017-04-04T23:24:50-07:00
by fmw42
Generally a good idea to put +repage after the trim. Can you post your input and result to some place such as dropbox.com and put the URL here so we can see where the text is getting cropped off and possibly suggest a fix? IM 6.7.7 is very old and perhaps the caption issue has been fixed by now.

Re: Annotating photos with metadata

Posted: 2017-04-05T06:22:27-07:00
by snibgo
schievelbein wrote:I wish that I could put a blank line before the text so I could crop the text off later if I wanted.
With current IM, you can put "\n" or "\n\n" at the start of the "caption:" string.

Re: Annotating photos with metadata

Posted: 2017-04-05T06:53:16-07:00
by schievelbein
Thank you again for all of the help and suggestions.
I am using version 7.0.5-4 but still could not get the \n to work, maybe I was putting it in the wrong place?
Here is my code as it stands and all is good except that the caption overwrites part of the photo.
If I could figure out how to insert a line in the caption so that there is a space in case I need to crop the annotated image and re-annotate it, it would be great. I run this code by typing "annotate Test.jpg".
Any and all suggestions are helpful.

Code: Select all

read cw cf cdesc <<< $( identify -format "%w %[fx:h*.03] %[IPTC:2:120]" $1 )
convert $1 \( -clone 0 -size $cw -delete 0 -background black -gravity center -pointsize $cf -fill White caption:"\n $cdesc" -trim \) -append $1_annotated.jpg
Test.jpg
Image

Test_annotated.jpg
Image

Re: Annotating photos with metadata

Posted: 2017-04-05T07:24:04-07:00
by snibgo
schievelbein wrote:caption:"\n $cdesc" -trim
Well, you are adding blank space then trimming it off. If you need the "-trim", then you can add black space afterwards.

Or you could have a third image between your $1 image and the text. This image could be "-size 1x10 xc:White".

Re: Annotating photos with metadata

Posted: 2017-04-05T08:40:58-07:00
by schievelbein
THANK YOU very much, such a simple solution that I overlooked.
My script is working great and I am adding it to my workflow.
THANK YOU for all of the help.