Remove double quote from Keyword tag

Started by gunasilan, May 19, 2014, 05:07:15 AM

Previous topic - Next topic

gunasilan

Hi All,

I have a set of values in my tif file under Keyword tag with double quote. Is there any way I can remove the double quote using the Exiftool? For an example, my Keyword value = "He"llo" W"or"ld'. How do i change the value to become just Hello World(without quote). Any references links or advice is highly appreciated. Thanks

Phil Harvey

If you are on Mac or Linux, try this:

exiftool '-keywords<${keywords;tr/"//d}' FILE

or in Windows, I have been told that this is how it works:

exiftool "-keywords<${keywords;tr/"""//d}" FILE

where FILE is one or more file and/or directory names.

(this assumes that you are using IPTC:Keywords.  If you are using XMP instead, use "subject" instead of "keywords" in these commands.

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

gunasilan

My keyword contains more than 64 characters. I tried using exiftool '-keywords<${keywords;tr/"//d}' FILE and my keywords value truncated to 64 character only. I had changed the code and add + symbol like this. '-keywords+<${keywords;tr/"//d}' FILE and nothing happens. The double remains there. Please advice.

Phil Harvey

You can add the -m option to avoid the truncation.  See the IPTC tags documentation for details.

But my guess is that your keywords are stored improperly as a single string if the length is greater than 64 characters.  See FAQ 17 for a discussion of list-type tags.

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

gunasilan

The double quote is still there. My syntax looks like this exiftool -m '-keywords<${keywords;tr/"//d}' FileName

Below is the screen shot from the keyword tab.





Phil Harvey

Your keywords are definitely stored incorrectly.

But I don't know if the quotes are stored in the keywords or not.  They may be added the software you are using to display them.  Use ExifTool to extract them to see.  Then post the result here and I can help sort things out for you.

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

gunasilan

Yes, there is no double quote if I extract from exiftool in my terminal. Please refer the screen shot.


Quote from: Phil Harvey on May 22, 2014, 08:08:02 AM
Your keywords are definitely stored incorrectly.
Can you explain more on this? I have no idea why you said so. Please advice.
Thanks

Phil Harvey

OK.  I understand now.

I said your keywords are stored incorrectly because they are stored as a single string instead of individual keywords.  (Did you read FAQ 17?)

The following command will fix this:

exiftool "-keywords<keywords" -sep "; " FILE

This command rewrites the keywords, using "; " as a separator to split the string into individual keywords.

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