ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: instigator on December 01, 2010, 09:26:40 AM

Title: keywords problems
Post by: instigator on December 01, 2010, 09:26:40 AM
When I use this command:
exiftool "-IPTC:keywords-=word1" "-Exif:copyright<${keywords}, word1" "-IPTC:keywords+=word1" -overwrite_original prueba.jpg
Example:
the keywords of the file named prueba.jpg was: "word1" and "word2"
with this command are:
Keywords:"word1,word2" (with keywords work OK)
Copyright: "word1,word2,word1"      (does'nt read correctly the keywords)
Any suggestion?
What I want is add a keyword(previously erase the keyword for,so the keyword don't repeat" copy the information of keywords to copyright, plus "word1", and then add "word1" to keywords.
I want do this running the program only one time
Title: Re: keywords problems
Post by: Phil Harvey on December 01, 2010, 11:21:22 AM
When copying tags, the source tag value is always the value as extracted directly from the file.

The best way to modify a value before it is copied to another tag is to create a user-defined tag.  There are many examples of how to do this (https://exiftool.org/forum/index.php?action=search2&amp;search=code+userdefined) in this forum.

- Phil
Title: Re: keywords problems
Post by: instigator on December 01, 2010, 11:36:33 AM
Quote from: Phil Harvey on December 01, 2010, 11:21:22 AM
When copying tags, the source tag value is always the value as extracted directly from the file.

The best way to modify a value before it is copied to another tag is to create a user-defined tag.  There are many examples of how to do this (https://exiftool.org/forum/index.php?action=search2&amp;search=code+userdefined) in this forum.

- Phil


I don't know how to create a user-defined for this. Can Help me please?
Title: Re: keywords problems
Post by: Phil Harvey on December 01, 2010, 12:18:16 PM
It is true that the value conversion for list-type tags is a bit trickier.  The following conversion will remove the keyword "word1" (case insensitive) from the list:

    ValueConv => q{
        my @list = ref $val eq 'ARRAY' ? @$val : ($val);
        @list = grep !/^word1$/, @list;
        return join ', ', @list;
    },


- Phil
Title: Re: keywords problems
Post by: instigator on December 07, 2010, 10:04:38 AM
sorry for my ignorance, really I don't know what are you talking about.
So i really appreciate if you tell me how can be the entire function, and where I put this:
ValueConv => q{
        my @list = ref $val eq 'ARRAY' ? @$val : ($val);
        @list = grep !/^word1$/, @list;
        return join ', ', @list;
    },

in other words, how can be the entre function if I run exiftool from cmd?
Title: Re: keywords problems
Post by: Phil Harvey on December 07, 2010, 10:21:11 AM
The config file documentation (https://exiftool.org/config.html) describes how to create user-defined tags.  Basically, you need to create a config file with a user-defined Composite tag and the above ValueConv conversion.  This forum contains lots of examples to help you (see the search link in my previous post).

- Phil