You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Bhaarat Sharma <bh...@gmail.com> on 2016/10/26 19:36:43 UTC

How to embed xml xml to png

I read the following on the format page of commons imaging IO

"Can read XMP XML (as as String) from TIFF, GIF, PNG, JPEG and PSD. Can
embed XMP XML when writing GIF, PNG and TIFF. Can remove, insert and update
XMP XML into existing JPEG files."

However, I'm unable to find an example that shows how to embed xmp xml to
PNG, GIF, or TIFF images. Using the code below, I can do it for a JPEG.

            String xmpXml = "<x:xmpmeta>" +
            "\n<Lifeshare>" +
            "\n\t<Date>"+"some date"+"</Date>" +
            "\n</Lifeshare>" +
            "\n</x:xmpmeta>";
            JpegXmpRewriter rewriter = new JpegXmpRewriter();
            rewriter.updateXmpXml(is,os, xmpXml);

Can someone point me in the direction of how to embed xmp xml to png?