String conversion of metadata

Started by gongi, March 30, 2010, 09:20:51 AM

Previous topic - Next topic

gongi

Hi all,
I use exiftool to extract custom XMP metadata from different type of image, layout,sound and video.
I use exiftool 8.10 with a custom config file.
I have a string metadata value set to "284/09"; when I extract this with exiftool I obtain a numeric value: the numeric result of 284/09 and not the string!

Anybody can help me?

My custom config file is:

%Image::ExifTool::UserDefined::xxx = (
   GROUPS => { 0 => 'XMP', 1 => 'XMP-xmp_prefix', 2 => 'Image' },
   NAMESPACE => { 'xmp-prefix' => 'http://ns.gongi.com/1.0/' },
   WRITABLE => 'string',
   # replace "NewXMPxxxTag1" with your own tag name (ie. "MyTag")
   Leaflet => { },
);


and the result of: exiftool  -ext indd -ext mp3 -ext avi -ext mov -ext aiff -all:all -b -o %d%f.%e.xmp my_folder-r

is:

<xmp_prefix:Leaflet>31.5555555555556</xmp_prefix:Leaflet>


Hi

--Alessandro





Phil Harvey

Hi Alessandro,

ExifTool will read back your new tag as '284/09' if the tag is defined in the config file and doesn't have Writable set to 'rational'.  Rational types are converted to a decimal value when extracting.

However, if you read back any XMP tag which isn't previously defined, exiftool will assume it is a rational type if it looks like a rational value.  So it seems that your config file must not be active when you are reading back the value because exiftool is treating your new tag as a rational.

I hope this makes sense.

- 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 ($).

gongi

Hi Phil,
thank you for the quick response.
if I understand, you're telling me that config file is not used in my extraction.
For this purpose, I have appended in the config file, just before end:

print "LOADED version 3!\n";
1;  #end


to see if config file is loaded.
When I run exiftool, I see this message on screen, so I suppose config file is loaded.
Unless I'm wrong....


Thanks a lot,

--Alessandro

Phil Harvey

Hi Alessandro,

It seems we have a bit of a mystery on our hands.  With ExifTool 8.16 and the sample .ExifTool_config file installed, I get this behaviour:

> exiftool a.jpg -newxmpxxxtag1=284/09
    1 image files updated

> exiftool a.jpg -newxmpxxxtag1
New XM Pxxx Tag 1               : 284/09


Can you try this to see what you get?  If you don't get the above results, then the only explanation I could imagine is that you are using a version of exiftool older than 6.87.

- 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 ($).

gongi

Hi Phil,
it seems a mistery, right.
I did a few tests with the last production build, 8.15.
My custom xmp tag is, as you seen, Numero_Busta_Imp and I test it for indd and jpg files:

exiftool G09SS10_02AMp284_09.indd -Numero_Busta_Imp=284/09
LOADED version 3!
    1 image files updated

exiftool G09SS10_02AMp284_09.indd -Numero_Busta_Imp
LOADED version 3!
Numero Busta Imp                : 31.5555555555556

exiftool G09SS10_02AMp284_09.indd -n -Numero_Busta_Imp
LOADED version 3!
Numero Busta Imp                : 31.5555555555556

exiftool a.jpg -Numero_Busta_Imp=284/09
LOADED version 3!
    1 image files updated

exiftool a.jpg -Numero_Busta_Imp
LOADED version 3!
Numero Busta Imp                : 31.5555555555556


I try to see this metadata with Adobe Bridge and I confirm you that the value is setted to 284/09.
So, I suppose the extraction process is the problem.
I confirm you that I'm using 8.15 and a Windows XP PC.

Thanks,

Phil Harvey

Could you test with the sample config file from the distribution and the NewXMPxxxTag1 tag?  I want to rule out any differences with the config file you are using.

- 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 ($).

gongi

Hi Phil,
i test with the sample file and it works:

exiftool a.jpg -newxmpxxxtag1
LOADED original version !

exiftool a.jpg -newxmpxxxtag1=284/09
LOADED original version !
    1 image files updated

exiftool a.jpg -newxmpxxxtag1
LOADED original version !
New XM Pxxx Tag 1               : 284/09

exiftool G09SS10_02AMp284_09.indd -newxmpxxxtag1=284/09
LOADED original version !
    1 image files updated

exiftool G09SS10_02AMp284_09.indd -newxmpxxxtag1
LOADED original version !
New XM Pxxx Tag 1               : 284/09



I don't understand this...it's strange...
Here my config:

# This is a basic example of the definition for a new XMP namespace.
# This table is referenced through a SubDirectory tag definition
# in the %Image::ExifTool::UserDefined definition above.
# The namespace prefix for these tags is 'xxx', which corresponds to
# an ExifTool family 1 group name of 'XMP-xxx'.
%Image::ExifTool::UserDefined::xxx = (
    GROUPS => { 0 => 'XMP', 1 => 'XMP-archiviazione', 2 => 'Image' },
    NAMESPACE => { 'archiviazione' => 'http://ns.gongi.com/1.0/' },
    WRITABLE => 'string',
    # replace "NewXMPxxxTag1" with your own tag name (ie. "MyTag")
   Numero_Busta_Imp => { },
# XMP structures are defined as SubDirectory's
    NewXMPxxxStruct => {
        SubDirectory => { },
        Struct => 'MyStruct', # arbitrary name identifies entry in xmpStruct
        List => 'Seq',        # structures may also be elements of a list
    },
    # structure elements must be defined as separate tags.  The tag ID's
    # are the concatination of the structure tag ID with the ID of each
    # structure element in turn.  The list flag should be set if the
    # parent structure is contained in a list.
    NewXMPxxxStructX => { List => 1 },
    NewXMPxxxStructY => { List => 1 },
);



Phil Harvey

#7
Darn, I should have suggested using the -a -G1 options earlier (when extracting). :(

Your problem is that you have written your new tag under two different XMP namespaces, and you are only seeing the one that you aren't changing.

- Phil

[edit] No, wait.  Maybe there is another reason.  I have reproduced your problem and am currently investigating.
...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 ($).

Phil Harvey

OK.  The problem can happen if the user-defined XMP namespace is not defined properly.  I am guessing that you didn't change the 'xxx' to 'archiviazione' in the 'Image::ExifTool::XMP::Main' table.  You didn't give me all of your config file, and the missing part should look like this:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
        archiviazione => {
            SubDirectory => {
                TagTable => 'Image::ExifTool::UserDefined::xxx',
            },
        },
    },
);


Note that the key for your new namespace must be the same as the namespace name.

- 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 ($).

gongi

Wow, Phil, now it's works.
It was like you've supposed..I didn't change all the config file.
I changed it like your suggestion, and now it's ok.

Thanks a lot!

--Alessandro