Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exiv2 does not register certain namespaces present in an image #2932

Open
Wormnest opened this issue Mar 13, 2024 · 1 comment
Open

exiv2 does not register certain namespaces present in an image #2932

Wormnest opened this issue Mar 13, 2024 · 1 comment
Labels

Comments

@Wormnest
Copy link

Describe the bug

Certain xmp namespaces that we know are present in an image, do not get registered. When trying to retrieve the namespace it throws "No namespace info available for XMP prefix `Item'".

This is known to happen with:

To Reproduce

Steps to reproduce the behavior:

  1. Use the image from the above linked GIMP issue: https://shallowsky.com/tmp/PXL_20231220_182442817.jpg Note only the direct link works since Gitlab removes most metadata.

  2. Build and run the supplied sample program on the above image. (attaching a zip doesn't seem to work, so replaced cpp with txt)
    test-namespace.txt

  3. Tested on Windows 10 Home, 64-bit using:
    MINGW64:

$ ./namespace-test.sh
+++ Testing exiv2 namespace info (exiv2 version 0.27.7)
Container namespace: 'http://ns.google.com/photos/1.0/container/'.
Exiv2 exception: 'No namespace info available for XMP prefix `Item''

UCRT64:

$ ./namespace-test.sh
Testing exiv2 namespace info (exiv2 version 0.28.2)
Container namespace: 'http://ns.google.com/photos/1.0/container/'.
Exiv2 exception: 'No namespace info available for XMP prefix `Item''

Expected behavior

I expect it to return the namespace for the Item prefix just like it does for Container.

Desktop (please complete the following information):

  • OS and version: Windows 10 Home, 64-bit
  • Exiv2 version and source: MINGW64 0.27.7, UCRT64 0.28.2
  • Compiler and version: default as chosen by the MSYS2 project
  • Compilation mode and/or compiler flags: as above

Additional context

@Wormnest Wormnest added the bug label Mar 13, 2024
@kamiccolo
Copy link
Contributor

kamiccolo commented Apr 2, 2024

Same on Linux using 0.28.2:

$ ./a.out PXL_20231220_182442817.jpg
Testing exiv2 namespace info (exiv2 version 0.28.2)
Container namespace: 'http://ns.google.com/photos/1.0/container/'.
Exiv2 exception: 'No namespace info available for XMP prefix `Item'

Still trying to understand the issue though.

It do seam to dump the namespace/container info properly (?):

$ exiv2 -PX ./PXL_20231220_182442817.jpg
Xmp.hdrgm.Version                            XmpText     3  1.0
Xmp.xmpNote.HasExtendedXMP                   XmpText    32  9AABF2DA602006640FE14B0C857436F3
Xmp.Container.Directory                      XmpText     0  type="Seq"
Xmp.Container.Directory[1]                   XmpText     0  type="Struct"
Xmp.Container.Directory[1]/Container:Item    XmpText     0  type="Struct"
Xmp.Container.Directory[1]/Container:Item/Item:Mime XmpText    10  image/jpeg
Xmp.Container.Directory[1]/Container:Item/Item:Semantic XmpText     7  Primary
Xmp.Container.Directory[2]                   XmpText     0  type="Struct"
Xmp.Container.Directory[2]/Container:Item    XmpText     0  type="Struct"
Xmp.Container.Directory[2]/Container:Item/Item:Mime XmpText    10  image/jpeg
Xmp.Container.Directory[2]/Container:Item/Item:Semantic XmpText     7  GainMap
Xmp.Container.Directory[2]/Container:Item/Item:Length XmpText     6  207318

Result of image->xmpPacket() do seam to contain stuff as well:

<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?> 
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 4.4.0-Exiv2">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
   <rdf:Description rdf:about="" xmlns:hdrgm="http://ns.adobe.com/hdr-gain-map/1.0/" xmlns:xmpNote="http://ns.adobe.com/xmp/note/" xmlns:Container="http://ns.google.com/photos/1.0/container/" xmlns:Item="http://ns.google.com/photos/1.0/container/item/" hdrgm:Version="1.0" xmpNote:HasExtendedXMP="9AABF2DA602006640FE14B0C857436F3">
   <Container:Directory>
      <rdf:Seq>
         <rdf:li rdf:parseType="Resource">
           <Container:Item Item:Mime="image/jpeg" Item:Semantic="Primary"/>
         </rdf:li>
         <rdf:li rdf:parseType="Resource">
            <Container:Item Item:Mime="image/jpeg" Item:Semantic="GainMap" Item:Length="207318"/>
         </rdf:li>
        </rdf:Seq>
      </Container:Directory>
    </rdf:Description>
  </rdf:RDF>
</x:xmpmeta>  

Also, the list of registered namespaces only contains "Container namespace" (and bunch of other, unrelated ones):

    Exiv2::Dictionary ns_dict;
    Exiv2::XmpProperties::registeredNamespaces(ns_dict);
    for (auto const& entry : ns_dict)
    {
        std::cout << entry.first << ": " << entry.second << std::endl;
    }
...
...
xmpRights: http://ns.adobe.com/xap/1.0/rights/
xmpT: http://ns.adobe.com/xap/1.0/t/
xmpTPg: http://ns.adobe.com/xap/1.0/t/pg/
xmpidq: http://ns.adobe.com/xmp/Identifier/qual/1.0/
Container namespace: 'http://ns.google.com/photos/1.0/container/'.

It would seem, that http://ns.adobe.com/hdr-gain-map/1.0/" is also missing o_0

But despite everything, accessing by explicit key works:

$ exiv2 -K "Xmp.Container.Directory[1]/Container:Item" ./PXL_20231220_182442817.jpg
Xmp.Container.Directory[1]/Container:Item    XmpText     0  type="Struct"

o_0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants