XMP namespace doesn't get updated

Started by anvoit, April 17, 2010, 09:18:11 AM

Previous topic - Next topic

anvoit

Hi Phil,

I think I've found a bug in exiftool and wanna ask you for your help.

I have a picture file with an invalid XMP-MP entry:

        <rdf:Description xmlns:MP="http://ns.microsoft.com/photo/1.2/" rdf:about="">
            <MP:RegionInfo>
                <rdf:Description xmlns:MPRI="http://ns.microsoft.com/photo/1.2/" rdf:about="">
                    <MPRI:Regions>
                        <rdf:Bag>
                            <rdf:li>
                                <rdf:Description xmlns:MPReg="http://ns.microsoft.com/photo/1.2/t/Region#" rdf:about="">
                                    <MPReg:PersonDisplayName>Test Francesca</MPReg:PersonDisplayName>
                                    <MPReg:Rectangle>0.1926146, 0.08867018, 0.06730755, 0.1447776</MPReg:Rectangle>
                                </rdf:Description>
                            </rdf:li>
                        </rdf:Bag>
                    </MPRI:Regions>
                </rdf:Description>
            </MP:RegionInfo>
        </rdf:Description>


The line

<rdf:Description xmlns:MPRI="http://ns.microsoft.com/photo/1.2/" rdf:about="">

is wrong. The namespace specifier for MPRI is wrong.

Now I try to rewrite this XMP-MP item with the following command:

exiftool  -preserve -ignoreMinorErrors -charset iptc=UTF8 -overwrite_original -xmp-mp:ALL= -xmp-mp:RegionPersonDisplayName="Test Francesca" -xmp-mp:RegionRectangle="0.1926146, 0.08867018, 0.06730755, 0.1447776" -v2 picture.jpg

  Deleting tags in: XMP-MP
  Writing new tags after deleting groups: XMP-MP
Writing XMP-MP:RegionPersonDisplayName
Writing XMP-MP:RegionRectangle
======== picture.jpg
Rewriting picture.jpg...
  Editing tags in: APP1 XMP
  Creating tags in: APP1 XMP
JPEG APP0 (14 bytes):
JPEG APP1 (15187 bytes):
JPEG APP1 (11578 bytes):
  Rewriting XMP
    - XMP-MP:RegionInfoRegionsRectangle = '0.1926146, 0.08867018, 0.06730755, 0.1447776'
    - XMP-MP:RegionInfoRegionsPersonDisplayName = 'Test Francesca'
    + XMP-MP:RegionPersonDisplayName = 'Test Francesca'
    + XMP-MP:RegionRectangle = '0.1926146, 0.08867018, 0.06730755, 0.1447776'
JPEG APP13 (172 bytes):
JPEG DQT (65 bytes):
JPEG DQT (65 bytes):
JPEG SOF0:
JPEG DHT (29 bytes):
JPEG DHT (179 bytes):
JPEG DHT (29 bytes):
JPEG DHT (179 bytes):
JPEG SOS
    1 image files updated


What I get now is (the XMP-MP structure):

        <rdf:Description rdf:about="" xmlns:MP="http://ns.microsoft.com/photo/1.2/" xmlns:MPRI="http://ns.microsoft.com/photo/1.2/" xmlns:MPReg="http://ns.microsoft.com/photo/1.2/t/Region#">
            <MP:RegionInfo rdf:parseType="Resource">
                <MPRI:Regions>
                    <rdf:Bag>
                        <rdf:li rdf:parseType="Resource">
                            <MPReg:PersonDisplayName>Test Francesca</MPReg:PersonDisplayName>
                            <MPReg:Rectangle>0.1926146, 0.08867018, 0.06730755, 0.1447776</MPReg:Rectangle>
                        </rdf:li>
                    </rdf:Bag>
                </MPRI:Regions>
            </MP:RegionInfo>
        </rdf:Description>


As you can see, the XMP-MP structure was rewritten, but still is wrong (the MPRI namespace specifier is still wrong)!

Do you agree that this is a bug? If not, how can I force exiftool to write the correct data (to correct the erroneous XMP-MP structure)?

Thanks,

Andreas

Phil Harvey

Hi Andreas,

This is the way I designed it.  ExifTool will maintain the existing namespace URI when rewriting.  I agree it would make sense if exiftool forgot about the URI's for namespaces in groups which are being deleted, but I looked into this and it is not as simple as one might think to do this because there are often more than one namespaces associated with a given ExifTool group (in this case: MP, MPRI and MPReg).

So currently the only way to fix an incorrect namespace is to delete the group then add back the tags in a separate command.

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