Thread

Posted on Thu Jul 17 06:09:28 2008 by leland
rewrite all tags
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.
Direct Responses: 8341 | Write a response
Posted on Thu Jul 17 13:58:06 2008 by exiftool in response to 8340
Re: rewrite all tags
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 -F option to enable exiftool to attempt to fix the offsets.

If you want to send me a sample image (phil at owl.phy.queensu.ca), I can give a more informed answer.

- Phil
Direct Responses: 8346 | Write a response
Posted on Fri Jul 18 02:20:05 2008 by leland in response to 8341
Re: rewrite all tags
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.
Direct Responses: 8350 | Write a response
Posted on Fri Jul 18 14:36:34 2008 by exiftool in response to 8346
Re: rewrite all tags
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
Direct Responses: 8355 | Write a response
Posted on Fri Jul 18 18:44:19 2008 by leland in response to 8350
Re: rewrite all tags
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!
Write a response