Hello.
Sorry, it's me again... ;)
This time, I'd like to remove the XMP:Subject tag from a file (attached).
$ exiftool -q -q -H -G -U -a 18.jpg|grep Subject
[XMP] - Subject : Hato Caves, Flitterwochen, Curaçao, Web, 2003, April, Mai, Juni,
I tried this:
$ exiftool -XMP:Subject= 18.jpg
0 image files updated
1 image files unchanged
$ exiftool -q -q -H -G -U -a 18.jpg|grep Subject
[XMP] - Subject : Hato Caves, Flitterwochen, Curaçao, Web, 2003, April, Mai, Juni,
Well, this didn't work...
Do I need to do it differently? ???
Thanks a lot,
Alexander
The problem is that the XMP in this file is non-standard. ExifTool will extract the non-standard XMP, but it won't write it.
It is non-standard because the APP1 header contains an extra space that it shouldn't have in the ID string.
I should possibly issue a warning when information like this is encountered. I will think about this.
- Phil
ExifTool 8.39 (just released) now issues a warning when processing images with a non-standard XMP header like this.
- Phil
Hi.
MacBook-Pro:Unsortiert alex$ exiftool -XMP:Subject= 18.jpg
Warning: [minor] Ignored APP1 XMP segment with non-standard header - 18.jpg
0 image files updated
1 image files unchanged
MacBook-Pro:Unsortiert alex$ exiftool -ver
8.39
So it works as intended. But do you know of a tool or a exiftool switch, which allows to delete this non-standard header? I've got Linux, OSX or Windows (in that order) and it's a larger amount of images, thus something scriptable would be "required".
Thanks,
Alexander
ExifTool doesn't give you an easy way to delete non-standard metadata because there is currently no way to refer to this information. Your only option is to delete everything and keep what you want, something like this:
exiftool -all= --exif:all --jfif:all --photoshop:all --iptc:all --xmp:all --icc_profile:all DIR
- Phil
Quote from: Phil Harvey on November 10, 2010, 05:37:15 PM
The problem is that the XMP in this file is non-standard. ExifTool will extract the non-standard XMP, but it won't write it.
It is non-standard because the APP1 header contains an extra space that it shouldn't have in the ID string.
Hm, if it's just an extra space, wouldn't it work if I'd "hexedit away" the space char? If I use a hexeditor, at what spot is the space? I'll attach a Hex Dump...
Thanks a lot,
Alexander
———————
Update:
Is it the following string? "http://ns.adobe.com/xap/1.0/ " at 0x5c02 (ie. the space 0x20 is at 0x5c1e)
(http://img.skitch.com/20101119-n5hg1s727qgp2pk7pr2bnj5bk3.png)
I removed the trailing space and then exiftool was able to modify the XMP:Subject. Did I find the correct spot?
Cheers,
Alex
Hi Alex,
Sure, you could try this. There should be a null directly after "http://ns.adobecom/xap/1.0/".
- Phil
Phil,
you reply to quickly ;D
In the updated post of mine, I've done just this. It works great.
Cheers,
Alexander
Yup. That's the one.
- Phil
Hi Phil!
Say, am I right in assuming, that it might not be as easy as simply removing the extra 0x20? :o
I've got the attached "original" and ran
perl -pi -e 's,(http://ns.adobe.com/xap/1.0/) (\0<\?xpacket),$1$2,' original-14-14.jpg
on it. This removed the extra 0x20 at 0x7978. It really only removed just this 1 byte. But now OSX Preview.app and also other apps like Image Magick can't deal with the file anymore... :(
MacBook-Pro:Christoffel Park alex$ identify -verbose modified.jpg
identify: Corrupt JPEG data: 68 extraneous bytes before marker 0xdb `modified.jpg' @ warning/jpeg.c/EmitMessage/230.
identify: Quantization table 0x00 was not defined `modified.jpg' @ error/jpeg.c/EmitMessage/235.
I get the exact same error (and file created), when I "manually" remove the 0x20 using a hex editor.
What's the best way to fix the broken header?
Cheers,
Alexander
Hi Alex,
You can't change the length of the file without adjusting the JPEG segment sizes. Instead, this should work:
perl -pi -e 's,(http://ns.adobe.com/xap/1.0/) (\0<\?xpacket),$1$2 ,' original-14-14.jpg
All I did was move the space to after "<?xpacket".
- Phil