[Originally posted by leland on 2008-07-17 03:09:28-07]
Hi, can someone help w/ syntax to force a rewrite of all tags in a directory structure? One program corrupted them so that they cannot be read by any program that uses the .net libraries.
[Originally posted by exiftool on 2008-07-17 10:58:06-07]So you didn't have backups of the originals from before they were corrupted?
I always recommend keeping copies of your original images if possible.
To rebuild the meta information for all files in a directory
hierarchy, you could do this:
exiftool -r -overwrite_original -all= -tagsfromfile @ -all:all DIR
This command deletes all meta information then copies it back from
the original file, rebuilding it in the process.
As usual I would recommend you keep backups. I have added
the
-overwrite_original option under this assumption. Otherwise
you can take out this option and exiftool will do the backups for you.
If you get minor errors, you can use the
-m option to ignore
them. This may happen since you say the files are corrupted.
Also, if you get makernote offset errors, you may want to add a
-Foption to enable exiftool to attempt to fix the offsets.
If you want to send me a sample image (philharvey66 at gmail.com),
I can give a more informed answer.
- Phil
[Originally posted by leland on 2008-07-17 23:20:05-07]
Thanks for this response.
The files are not completely corrupted. In fact most programs can read/write metadata just fine, however any program that uses .net jpeg libraries cannot.
The offending program was idimager, and I am looking for a way to simply rewrite all the metadata in my pictures so that it's kosher with the metadata police.
I didn't keep originals because I wasn't editing the pictures, just the metadata. And sadly, I could just delete all my metadata and start over, but that would be a pain in the neck. I have emailed you a file that references this thread.
Thanks for your help Phil.
[Originally posted by exiftool on 2008-07-18 11:36:34-07]
Thanks for the sample. The only questionable meta information
I can see are some XMP tags which may cause problems for any
application which reads the XMP. But exiftool can fix this.
For your sample, there are a number of tags which exiftool doesn't
write by default since they are protected, but when rebuilding
the information, these should be included. Sometime I may provide
an option to do this, but until then the protected tags have to
be specified individually. So your complete command is like this:
exiftool -r -overwrite_original -all= -tagsfromfile @ -all:all -interopindex -interopversion -all:ycbcrpositioning -all:compressedbitsperpixel DIR
A bit lengthy, but it should do the job.
- Phil
[Originally posted by leland on 2008-07-18 15:44:19-07]
Phil, thanks for all your help. I just tried this out on the test sample you sent me and it worked perfectly. I really appreciate this. You've saved a large number of pictures from the metadata abyss. Not the worst thing that could happen in this world, but certainly a thorn in my side.
Thanks again!