adobe / XMP-Toolkit-SDK

The XMP Toolkit allows you to integrate XMP functionality into your product or solution
BSD 3-Clause "New" or "Revised" License
205 stars 83 forks source link

XMPFiles::GetXMP() removes attributes with empty string. #72

Closed Mohammed-Javad closed 11 months ago

Mohammed-Javad commented 1 year ago

I have a png with Embedded xmp data as shown below

_

_ And I am reading the embedded xmp using XMPFiles::GetXMP() ### Expected Behaviour It should return the complete xmp. ### Actual Behaviour It returns empty string because the attributes values are empty string. #### Steps to Reproduce 1. Build the sample application ReadingXMP.exe. 2. create a Sample file with embedded xmp with attributes with empty string. 3. Run ReadingXMP.exe , pass Sample file as argument. 4. Observe that in the returned xmp the attributes with empty values are removed. #### Platform and Version Windows 10
maupadhyay commented 11 months ago

XMPFiles::GetXMP() internally calls SXMPUtils::ApplyTemplate where properties with empty values are either ignored or cause deletion. Hence the out xmpMeta object do not have empty values. This is expected behaviour.

In case you still need that packet GetXMP ( SXMPMeta * xmpObj = 0, tStringObj * xmpPacket = 0, XMP_PacketInfo * packetInfo = 0 ); https://github.com/adobe/XMP-Toolkit-SDK/blob/main/public/include/TXMPFiles.hpp#L627 can be called with non null string object in which it will return the raw XMP packet as stored in the file.