I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2008-02-18 10:35:54-08 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 2008-02-18 10:51:05-08 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 2008-02-18 13:50:35-08 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 2008-02-19 09:35:37-08 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 2008-02-19 13:41:55-08 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 2008-02-20 06:45:00-08 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 2008-02-22 14:51:09-08 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 2008-02-22 15:24:29-08 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 2008-02-22 18:32:38-08 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 2008-02-22 19:10:15-08 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 2008-02-22 19:23:17-08 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 2008-02-22 21:39:23-08 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
Direct Responses: Write a response
Posted on 2008-02-22 21:47:53-08 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 ;-)
Direct Responses: Write a response