Is there anyway to add xml data into an xml box for jpeg 2000's?
I found a few relevant threads through the search and ended up trying quite a few variations of:
exiftool -E -xml+="$xml" image.jp2
where xml=`cat metadata.xml`
I'm not sure if this is beyond the capabilities of Exiftool because under Writable Y/N it says undefined https://exiftool.org/TagNames/Jpeg2000.html
If Exiftool cannot write the xml box, is there any software that can? I found J2kcodec's Metadata Editor (http://j2k-codec.com/mde.html) but it's GUI only and cannot be made part of a batch process, making it rather useless to me.
Thankyou.
Hmmm. I think this could work:
exiftool -E '-xml<${xml}'"$xml" image.jp2
The confusing thing is that you want ExifTool to interpret the first "$xml" (to represent the existing XML), then [presumably] the shell to interpret the second (where your new XML data is stored).
- Phil
Edit: I don't know about the usefulness of -E in this command. It will probably work fine without it.
Thanks for the quick response!
I think the -E option is probably unnecessary, I just didn't know what else to try.
I tried the command you suggested, I get the error message:
Warning: [minor] Tag 'xml' not defined - image.jp2
Warning: No writable tags found - image.jp2
0 image files updated
1 image files unchanged
This will happen if the XML tag doesn't already exist in the file. Add -m if you want to ignore this and write your new XML anyway. If there is no existing XML, the command could be simplified, but I thought the point was to add to existing XML.
- Phil
No, sorry, there are no existing XML tags, adding the -m option stops the first error message, however I still get 'No writable tags found'?
I tried it, and it works for me. Here is my script:
#!/bin/bash
xml=`cat a.xml`
exiftool -m '-xml<${xml}'"$xml" a.jp2
without the -m, I get this if the XML doesn't already exist:
Warning: [minor] Tag 'xml' not defined - a.jp2
Warning: No writable tags set from a.jp2
0 image files updated
1 image files unchanged
but with -m I get this:
1 image files updated
- phil
I copied your script exactly and I still get the 'Warning: No writable tags found' error, I've already used jpylyzer to check they're valid jp2 files and xmllint to check the XML is valid too.
I'm going to try updating my version of Exiftool, I see the latest is 9.82, however aptitude only updates to 8.2
That would do it. The ability to read/write the Jpeg2000 XML tag was added in version 9.14 (two years ago). Version 8.2 is almost 5 years old. You should complain to the maintainers of the aptitude package.
- Phil