如何修剪jpg中包含的XMP XML [英] How do you trim the XMP XML contained within a jpg

查看:338
本文介绍了如何修剪jpg中包含的XMP XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过使用sanselan,我发现导入Windows的iPhone照片变得无法编辑的根本原因是实际XML后面有内容(空格?)(有关详细信息和不良XMP的链接示例) XML参见 https://apple.stackexchange.com/questions/45326/why-can-i-not-edit-some-photos-imported-from-an-iphone-to-windows-vista ).

Through the use of sanselan I've found that the root cause of iPhone photos imported to windows becoming uneditable is that there is content (white space?) after the actual XML (for more details and a linked example of the bad XMP XML see https://apple.stackexchange.com/questions/45326/why-can-i-not-edit-some-photos-imported-from-an-iphone-to-windows-vista).

我想浏览照片档案并修剪" XMP XML.

I'd like to scan through my photo archive and 'trim' the XMP XML.

有一种简单的方法吗?

我有一些Java代码可以递归浏览我的照片档案并检测问题.我不确定如何修剪和写回XML.

I have some java code that can recursively navigate my photo archive and DETECT the issue. I'm not sure how to trim and write the XML back though.

推荐答案

以任何方式获取现有XML.

Obtain the existing XML using any means.

如果使用 Apache Sanselan库,则以下方法有效:

The following works if using the Apache Sanselan library:

String xmpXml = Sanselan.getXmpXml(new File('/path/to/jpeg'));

然后修剪...

xmpXml = xmpXml.trim();

然后使用 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆