dragon66 / icafe

Java library for reading, writing, converting and manipulating images and metadata
Eclipse Public License 1.0
204 stars 58 forks source link

Documentation Error class JPEGTweaker method insertXMP() #52

Closed codingandmore closed 6 years ago

codingandmore commented 7 years ago

The Javadoc for class JPEGTweaker states for method insertXmp:

The standard part of the XMP must be a valid XMP with packet wrapper and, should already include the GUID for the ExtendedXMP in case of ExtendedXMP

Looking at the result and the source code, this seems to be incorrect. The tag xmpNote:HasExtendedXMP with the MD5 checksum is created by the function itself: `

...
            if(extendedXmp != null) { // We have ExtendedXMP
        guid = StringUtils.generateMD5(extendedXmp);
        NodeList descriptions = xmpDoc.getElementsByTagName("rdf:Description");
        int length = descriptions.getLength();
        if(length > 0) {
            Element node = (Element)descriptions.item(length - 1);
            node.setAttribute("xmlns:xmpNote", "http://ns.adobe.com/xmp/extension/");
            node.setAttribute("xmpNote:HasExtendedXMP", guid);
        }
    }

`

It should be: The standard part of the XMP must be a valid XMP with packet wrapper. In case of ExtendedXMP the required namespace and the tag xmpNote:HasExtendedXMP will be added.

By the way: Fantastic to have support for extended XMP in the library!

dragon66 commented 7 years ago

@codingandmore Thanks for the comment. I will fix it when I got a chance.

dragon66 commented 6 years ago

@codingandmore This is now fixed and added more comment as a result of automatic XMP data split implemented by JpegXMP.