How do you trim the XMP XML contained within a jpg

笑着哭i 提交于 2019-12-05 23:17:25
Randyaa

Obtain the existing XML using any means.

The following works if using the Apache Sanselan library:

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

Then trim it...

xmpXml = xmpXml.trim();

Then write it back to the file using the solution to serializing Xmp XML to an existing jpeg.

try the following steps:

  1. collect all of the photos in a single folder (e.g. folder xmlToConvert on your Desktop)
  2. open a Terminal.app window
  3. cd to the directory you put the files in (e.g. cd ~/Desktop/xmlToConvert)
  4. run the following command from your command line prompt

    mkdir converted ; for f in *.xml ; do cat $f | head -n $(wc -l $f) > converted/$f ; done

the converted/ sub-directory should now contain all the files without the whitespace at the end.

(i.e. a folder called converted in the xmlToConvert you created on your Desktop)

hth

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