Library for writing XMP to a multipage TIFF

笑着哭i 提交于 2019-12-12 20:27:30

问题


Can you recommend a library that lets me add XMP data to a TIFF file? Preferably a library that can be used with Java.


回答1:


There is JempBox which is open source and allows the manipulation of XMP streams, but it doesn't look like it will read/write the XMP data in a TIFF file.

There is also Chilkat which is not open source, but does appear to do what you want.




回答2:


It's been a while, but it may still be useful to someone: Apache Commons has a library called Sanselan suitable for this task. It's a bit dated and the documentation is sparse, but it does the job well nevertheless:

    File file = new File("path/to/your/file");

    // Get XMP xml data from a file
    String xml = Sanselan.getXmpXml(file);

    // Process the XML data
    xml = processXml(xml);

    // Write XMP xml data from a file
    Map params = new HashMap();
    params.put(Sanselan.PARAM_KEY_XMP_XML, xml);
    BufferedImage image = Sanselan.getBufferedImage(file);
    Sanselan.writeImage(image, file, Sanselan.guessFormat(file), params);

You may have to be careful with multipage TIFFs though, because Sanselan.getBufferedImage will probably only get the first (so only the first gets written back).



来源:https://stackoverflow.com/questions/1838829/library-for-writing-xmp-to-a-multipage-tiff

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!