registering/deleting xmptags issue

Added by andreas schmid almost 7 years ago

hi,

im trying to register my own namespace for an xmptag and i can add it successfully with the command:
exiv2 -M 'reg whatevertag http://ns.whatevertag.pro/whatevertag/v1/' -M'set Xmp.whatevertag.val asdfasd' image.jpg

what i noticed is that sometimes it adds a namespace like 'whatevertag_1_' to the image so i have the one i registered ( Xmp.whatevertag.val) but also one like Xmp.whatevertag_1_.val which i don't really like.

why is this tag in there?

if i try to delete it what happens is that the tag gets deleted but a new one appears like: Xmp.whatevertag_1__1_.val

any help?


Replies (7)

RE: registering/deleting xmptags issue - Added by Andreas Huggel almost 7 years ago

This sounds vaguely familiar. Can you provide a sample image and the commands to reproduce the issue?

RE: registering/deleting xmptags issue - Added by andreas schmid almost 7 years ago

this seems to happen only with some files.

we tried it with v.0.20 and v.0.19. same thing

how to reproduce:
write with the following command on the attached 001.jpg

exiv2 -M 'reg imageapp http://ns.imagapp.pro/imageapp/v1/' -M 'set Xmp.imageapp.uuid ab75b096-83d3-11df-91a5-000c2953179a' 001.jpg

exiv2 doubles the namespace and writes a Xmp.imageapp_1_.uuid instead of overwrite the actual value which is already in.
the same happens if you clean up all metatdata lets say with expression media and run the command.

the second attached file contains the double namespaces.

let me know what you think

001.jpg (899 KB)

001-double-namespace.jpg (897 KB)

RE: registering/deleting xmptags issue - Added by Andreas Huggel almost 7 years ago

Thanks for the reproducer. The root cause appears to be that the URL of the imageapp namespace that already exists in the image is different from that in the command above: http://ns.adobe.com/imageapp/1.0/
If I run the command with that URL instead, it works.

However that is a workaround at best. There are at least two issues here that need further investigation:

  1. Why is it necessary to register a namspace that already exists?
  2. How should re-registration of a namespace with a different URL really work?

Andreas

RE: registering/deleting xmptags issue - Added by andreas schmid almost 7 years ago

there might be a problem in my app then.

the workflow is:
- get the uuid
- the uuid tag doesn't exit yet, so register the namespace and write a uuid to the file.

so that means something is wrong in my first step.

i didn't really see the different url in the namespace.
thanks a lot for pointing that out.

RE: registering/deleting xmptags issue - Added by andreas schmid almost 7 years ago

is there a way to 'migrate' the namespaces url?

RE: registering/deleting xmptags issue - Added by Andreas Huggel almost 7 years ago

Now there is (with the latest changes in r2374), which also answers my own second question above:

$ exiv2 -M 'reg imageapp http://ns.imagapp.pro/imageapp/v1/' -M 'set Xmp.imageapp.uuid ab75b096-83d3-11df-91a5-000c2953179a' 001.jpg
Warning: Updating namespace URI for imageapp from http://ns.adobe.com/imageapp/1.0/ to http://ns.imagapp.pro/imageapp/v1/
$ exiv2 -g Xmp.imageapp.uuid 001.jpg
Xmp.imageapp.uuid                            XmpText    36  ab75b096-83d3-11df-91a5-000c2953179a

Is that better?

As for the first question, the exiv2 tool parses the command line and validates all keys found in the modify commands before it reads the image, that's why it needs reg commands on the command line even for custom namespaces which are in the image. There is room for improvement here.

Another small feature that might be useful in this context is a command line option to write out all schema namespace prefixes and URIs of an XMP packet.

Andreas

RE: registering/deleting xmptags issue - Added by Andreas Huggel almost 7 years ago

Another small feature that might be useful in this context is a command line option to write out all schema namespace prefixes and URIs of an XMP packet.

Experimented a bit with this but it turns out this is not as small as expected and requires a conceptual change. Currently the XMP-SDK uses a global registry for namespaces and prefixes, and Exiv2 follows this model. But after playing around with this, it is clear that this not a good idea. Instead this registry should be per object, probably in XmpData for Exiv2 and similar in XMP-SDK.

(1-7/7)

Redmine Appliance - Powered by TurnKey Linux