Question

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).

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

Is there an easy way to do this?

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.

Was it helpful?

Solution

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top