Thread

Posted on Mon Feb 18 12:35:54 2008 by loloeroket
Append value to existing tag
Hello, I am trying to use template files to adjust iptc tags: exiftool -@ template.args file.jpg where template.args looks like this: # template.args -IPTC:CopyrightNotice=Text -IPTC:By-line=Text -IPTC:Credit=Text -IPTC:Caption-Abstract=$caption-abstract Text # end I end up with Caption field looking like that: $caption-abstract Text. Is there a way to do this or do I have to use command line? Thanks, Laurent
Direct Responses: 7121 | Write a response
Posted on Mon Feb 18 12:51:05 2008 by loloeroket in response to 7120
Re: Append value to existing tag
I realized that my first post is not readable. I am sorry and repost it:

I am trying to use template files to adjust iptc tags:
exiftool -@ template.args file.jpg

where template.args looks like this:

# template.args
-IPTC:CopyrightNotice=Text
-IPTC:By-line=Text
-IPTC:Credit=Text
-IPTC:Caption-Abstract=$caption-abstract Text
# end

I end up with Caption field looking like that: $caption-abstract Text. Is there a way to do this or do I have to use command line?
Thanks, Laurent
Direct Responses: 7124 | Write a response
Posted on Mon Feb 18 15:50:35 2008 by exiftool in response to 7121
Re: Append value to existing tag
Hi Laurent,

This will work if you use the proper argument syntax.

For the caption-abstract, you don't want to assign a new value (with "="). Instead, you want to "redirect" the value from another tag (with "<"). Of course, in this case the tag is itself, but the same syntax applies:

-IPTC:Caption-Abstract<$caption-abstract Text

- Phil
Direct Responses: 7132 | Write a response
Posted on Tue Feb 19 11:35:37 2008 by loloeroket in response to 7124
Re: Append value to existing tag
Hi Phil, This is wonderful! Is there by chance the possibility to replace some text by chance? I know I am pushing my luck.
Also if I want to compile several fields in one, I do like this?

-IPTC:Caption-Abstract<$caption-abstract Text $CreatedDate $City, $Country

I saw in the manual how to format the date.
And a last one for the road. Is there a way to make a carriage return?

Thanks,
Laurent
Direct Responses: 7134 | Write a response
Posted on Tue Feb 19 15:41:55 2008 by exiftool in response to 7132
Re: Append value to existing tag
Hi Larent,

You can reformat the text any way you want by creating a user-defined Composite tag to do what you want. Search the forum and you will see some examples of this.

$/ may be used for a newline. You should read the -p description in the application documentation because I'm sure you'll have more questions that this may answer.

- Phil
Direct Responses: 7144 | Write a response
Posted on Wed Feb 20 08:45:00 2008 by loloeroket in response to 7134
Re: Append value to existing tag
Thanks for the reply,
It sounds interesting this user-defined composite tag. I believe it is perl.. I need to dig into it.

Laurent
Direct Responses: 7164 | Write a response
Posted on Fri Feb 22 16:51:09 2008 by loloeroket in response to 7144
Re: Append value to existing tag
I am coming back with my stupid questions.
I tried the '$/' in the .args but it prints ...'$/'. Also when the field IPTC:caption-abstract doesn't exist in the file there is an error Warning: [minor] Tag 'caption-abstract' not defined - -, I read the manual (If a tag does not exist, the output value is set to '-' if the -f option is used.) but I tried to put -f but without success and my file is corrupted (4K).
I tried the -p option but it doesn't seem to work either in case of .args file. Or simply I don't get the syntax.
Laurent
Direct Responses: 7166 | Write a response
Posted on Fri Feb 22 17:24:29 2008 by exiftool in response to 7164
Re: Append value to existing tag
> cat t.args -IPTC:Caption-Abstract<$caption-abstract Text $CreatedDate $City, $Country $/ new line > exiftool a.jpg -iptc:all > exiftool a.jpg -@ t.args Warning: [minor] Tag 'caption-abstract' not defined - a.jpg 0 image files updated 1 image files unchanged > exiftool a.jpg -@ t.args -f 1 image files updated > exiftool a.jpg -iptc:all Caption-Abstract : - Text - -, - . new line Application Record Version : 4 > exiftool a.jpg -caption-abstract -b - Text - -, - new line
Direct Responses: 7169 | Write a response
Posted on Fri Feb 22 20:32:38 2008 by loloeroket in response to 7166
Re: Append value to existing tag
Then it must come from my piping then.
//Image is first processed in ImageMagick then Piped to exiftool >convert $file_in -quality 85% -auto-orient - | exiftool -@ template.args -f ->$file_out
Direct Responses: 7170 | Write a response
Posted on Fri Feb 22 21:10:15 2008 by exiftool in response to 7169
Re: Append value to existing tag
Yes. That is the problem. Currently tags can not be copied in a pipeline. This is because the copy is effectively a read followed by a read/write, but a pipe can only be read once.

This is easier to understand when you realize there is an implicit -tagsFromFile option whenever you copy tags. So your command is effectively:

... | exiftool -tagsfromfile - ... - > ...

- Phil
Direct Responses: 7171 | 7173 | Write a response
Posted on Fri Feb 22 21:23:17 2008 by exiftool in response to 7170
Re: Append value to existing tag
But of course, I should have realized that you don't need to copy the tags in a pipeline anyway, since you should be able to read the tags from the original file. What about this?:

convert $file_in -quality 85% -auto-orient - | exiftool -tagsfromfile $file_in -@ template.args -f +->$file_out

- Phil
Direct Responses: 7172 | Write a response
Posted on Fri Feb 22 23:39:23 2008 by loloeroket in response to 7171
Re: Append value to existing tag
I am getting the following error:
Error: File not found - +- convert: Output file write error --- out of disk space? `-'.

Laurent
Write a response
Posted on Fri Feb 22 23:47:53 2008 by loloeroket in response to 7170
Re: Append value to existing tag
But this is working!!

convert $file_in -quality 85% -auto-orient - | exiftool -tagsfromfile $file_in -@ template.args -f + ->$file_out


What to say?? you rock!!
Thanks for this, it makes a killer sequence now. I will try to do the same with a directory now, Actually if the metadatas are the same I can simply take the same file as reference. I think I start to understand how the whole thing is working. And just for fun, I will try in the same pipe sequence to rename and ftp. It must be funny!

Laurent
PS: Now by previewing my message I realize the + sign was added by the forum. What a dummy I am ;-)
Write a response