My problem is I am trying to insert a large amount of RDF data into a jpeg image, specifically into the XMP headers. The RDF is specific to my application, with custom namespaces etc. However this should not affect the process of inserting RDF. I can do this with a small amount of RDF data, however I reach the XMP packet size limit when I try to insert anything larger.
I am using Java and the Apache Sanselan lib, however I'm open to use other libs.
Below is the code I am using in a test app to do this, however I do not know how to split it over multiple XMP packets in order for me to insert all the data I need to.
Any help or pointers in the right direction would be greatly appreciated :)
Thanks
private static File writeXmpToFile(File file, String xmpXmlAsString)
throws FileNotFoundException, ImageReadException, IOException,
ImageWriteException {
String XmpXmlAsString = xmpXmlAsString;
File fileWithXmpXml = new File(file.getParent(), file.getName()+ ".added-xmp" + ".jpg");
OutputStream os = null;
try {
os = new BufferedOutputStream(new FileOutputStream(fileWithXmpXml));
new JpegXmpRewriter().updateXmpXml(new ByteSourceFile(file), os, XmpXmlAsString);
} finally {
if (os != null) {
os.close();
}
os = null;
}
return fileWithXmpXml;
}