Closed coolboy closed 5 years ago
Uploading the example jpg
@coolboy The IPTC metadata implementation in ICFE is for IPTC-NAA only which is a legacy of the new XMP schema based IPTC. As a result, you will not be able to see all the IPTC fields defined by IPTC spec from the IPTC metadata extracted by ICAFE.
For JPEG image, IPTC information could be found either in a Photoshop IRB block (The subset of IPTC which is IPTC-NAA) or as part of the JPEG APP1 segment for XMP. The following is the IPTC information actually found inside the Photoshop IRB block which is consistent with IPTC-NAA:
I tested the image you provided, more detailed IPTC information including "Rights Usage Terms" are in the XMP metadata which ICAFE also extracted.
ICAFE provide access to the internal DOM Document node through XMP.getMergedDocument() method. But you need to find the actual data you want from there. XMP and all the other Metadata implemented Iterator interface and you can traverse the DOM tree.
Although some thoughts already in place as issue https://github.com/dragon66/icafe/issues/8, at the moment, it is still a bit complicated to extract specific information from XMP by ICAFE directly.The tag you want is "xmpRights:UsageTerms" but there could be multiple records under it. In the example image you provided, there is only one:
The IPTC information shown in your first screenshot correspond to the IPTC data inside XMP. Some XMP API may help you do the job or if you are good at working with DOM, you should be able to figure out a way to extract all the information from the XMP DOM tree.
Hi @dragon66
Thanks for your reply this is what I found out as well
BTW how to loop through or get the raw xml from XMP using icafe?
By checking your example https://github.com/dragon66/icafe/blob/master/src/com/icafe4j/test/TestMetadata.java#L68
I can't find the MetadataEntry in the current SNAPSHOT? Do we need to publish 1.2?
Thank you again
@coolboy You can get the DOM tree by calling getMergedDocument() on an XMP instance. It will return a Document object. If you want, you can call XMLUtils.serializeToString(Document doc) or XMLUtils.serializeToByteArray(Document doc). Just as the method names suggest,they will return either an XML string or a byte array from the DOM tree. You can further save it to a file if you want.
As for loop through XMP, after you get the DOM Document object, you can traverse it just as any normal XML file.
The SNAPSHOT is quite out of sync with the current repository. I need to setup the build process in a different computer which has no restriction as the one I am using. There is an issue opened for this by some other user. I will update that issue after I push the new SNAPSHOT.
thank you!
We want to keep all the copyright fields, but I just can't find a way in icafe to read "Rights Usage Terms" as example image below?