Removing quotation marks

Started by windlematt, June 25, 2010, 03:59:36 AM

Previous topic - Next topic

windlematt

Hi,

I'm trying to convert old Microsoft Digital Image Suite keywords to standard IPTC Keywords so that I can use them in products like Adobe Bridge.

The following command moves the keywords into the correct IPTC field I want:

exiftool "-keywords -description<xpkeywords" filename.jpg

But it leaves quotation marks around the keywords so they are not recognised as individual keywords in Bridge.

For example, in MDIS if I had 2 keywords say family, home then after conversion using the above command they appear in the IPTC field as "family, home" (with quotation marks) and are then only recognised as a single keyword in Bridge.

Is there an easy way to move them without having the quotation marks added in the process or even remove them afterwoulds?

I've got about 2,000 photo's to convert with lots of different keywords so would prefer not to go in and edit every single one.

And I'm running strawberry Perl on Windows XP if this helps.

Thanks in advance,
Matt.

Phil Harvey

Hi Matt,

First, I think you made a typo in your command.  It should be:

exiftool "-keywords<xpkeywords" filename.jpg

The quotation marks you mention are probably being added by Bridge when it displays the keywords.

The problem is that the XPKeywords is a single string.  But you can create a user-defined tag to separate the XPKeywords string using this config file:


%Image::ExifTool::UserDefined = (
    'Image::ExifTool::Composite' => {
        MyKeywords => {
            Require => 'XPKeywords',
            ValueConv => 'my @v = split(", ",$val); \@v',
        },
    }
);
1;  #end


with this installed, this command will do what you want:

exiftool "-keywords<mykeywords" filename.jpg

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

windlematt

Phil, genius, it works!

:)

Many thanks,
Matt.

amitinddr

Hi Phil
Thank you for gifting us with such an amazing tool. I am struggling around with a strange problem. I followed this thread to convert the keywords to IPTC standards. Now the  problem is with multiple keywords. My custom software reads space separated values. So for example, the Windows keywords rose;lily are currently converted to rose,lily (when I see through Mac) but I want them to be converted either as rose, lily (observe the space before lily) or simply rose lily. Your suggestion on this would be great help to me.

amitinddr

Just to elaborate attached S2 solves my purpose. It shows both keywords in different lines in ExifPilot but S1 does not. It shows keywords as , separated.

Phil Harvey

The IPTC:Keywords are stored separately.  The separator is not stored in the file.  ExifTool adds the separator after it extracts the Keywords, and this separator may be changed with the -sep option.  See FAQ 17 for more information about this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

amitinddr

Thanks Phil. I tried this and it worked well. Now I will import the images into the system and I am sure that it will work fine. Thanks for all your help.

amitinddr

Phil
It worked extremely well so far. The only thing I am left with is the backup files. I usually do not need backup files and they are quite annoying. I tried searching around but could not find out how I can prevent it from saving backup files. (Sorry I am a newbie). Please suggest.

Phil Harvey

Add the -overwrite_original option to avoid this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

elhiero

Very useful topic,  which describes how to use of a config file.
And useful link  https://exiftool.org/config.html
Thank you Phil !

I found this topic when I was looking for copying xpkeywords in newer metadatas  (iptc:keywords and xmp:subject)

In this script, you are using  "MyKeywords" as a user-defined tag , but unfortunately, this tag already exists (composite:mykeywords) and Microsoft photo gallery stores keywords also in this tag !  so, this exemple is a bit confuse ( for not english readers)
But the script works very well ...

Thanks

Phil Harvey

I think you misunderstood.  The Composite:MyKeywords tag defined in the config file is derived from XPKeywords.  So if this config file is active, and XPKeywords is defined, then ExifTool will report a value for MyKeywords.  This isn't a separate value stored in the file, but only a reformatted version of the value for XPKeywords (that is compatible for writing to IPTC:Keywords or XMP:Subject).

So Microsoft photo gallery stores XPKeywords, not MyKeywords.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

elhiero

Thanks for this very clear explanation
Yes, keywords are stored in XpKeywords but I can see in the tag list extracted by Exiftool that Microsoft  keywords are also stored in a metadata named  " Composite MyKeywords "   
( it's not a problem, just an information ... and I dont know what are "composite metadata" I only work with iptc, exif, xmp )

---- Composite ----
Aperture                        : 3.5
Image Size                      : 2592x1944
My Keywords                     : clown, train
Shutter Speed                   : 1/40
Thumbnail Image                 : (Binary data 15138 bytes, use -b option to extract)
Focal Length                    : 6.7 mm
Light Value                     : 8.3

... and for people speaking francais ( français  ;) ) , I'm writing a few pages about metadata here :
http://orchisere.pagesperso-orange.fr/logiciels/thumb.html



Phil Harvey

Maybe reading the explanation on the Composite tags documentation page would help clear things up.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

StarGeek

Quote from: elhiero on September 07, 2014, 05:08:47 AM
Yes, keywords are stored in XpKeywords but I can see in the tag list extracted by Exiftool that Microsoft  keywords are also stored in a metadata named  " Composite MyKeywords "   

Try running the same command but with -config "" as the very first option.  For example, ExifTool -config "" -g1 File.  You should see that the MyKeywords tag will disappear.  That's would be because the MyKeywords tag is a user defined tag in your .ExifTool_config file.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

elhiero

You are right, StarGeek.  I tried in a new directoy, and now this "virtual" metadata doesn't appear.

An admin should strike my wrong comments up there

In the directory where I was working, I wrote a config file named  old.exiftool_config
It seems that  exiftool reads this file, even through FastPhotoTagger GUI  (very good G.U.I. ! )