understanding exiftool's behaviour

Started by Chris Walton, January 17, 2020, 12:54:10 PM

Previous topic - Next topic

Chris Walton

I have been experimenting with, and testing, some aspects of exiftool. All tests have been done on test data. I tested one operation, that is specifically recommended against in the documentation. The test failed, and appeared to corrupt the file (as expected). However, the mode of failure was unexpected, and may have consequences for other things I attempt.

I removed one group of exif data from a NEF file with:
   exiftool.exe -HierarchicalSubject= "50B_1832 - Copy.NEF"
this produced (as expected) two files:
   50B_1832 - Copy.NEF (the modified file)
   50B_1832 - Copy.NEF_original (the original file)
the first file has the required modifications and appears to be normal and usable in every way
attempting to open the second file results in an error similar to:
   Warning! The file 50B_1832 - Copy.NEF_original is a TIF file with incorrect extension ! Rename ?
irrespective of renaming or not, continuing with the file open shows a preview image (160x120 pixels - much smaller than the thumbnail embedded in the pre-change photo)
if the file is renamed it becomes 50B_1832 - Copy.tif
if the tif file is renamed to 50B_1832 - Copy.NEF it corrects the apparent corruption, leaving a usable normal image

I thought at first that the _original file was corrupted. This would imply that the copy operation was destructive, while the modification operation was safe.

Now, it is apparent that I have mistaken ideas, as to what is actually going on. Could you throw some light on my confusion, please?

Alan Clifford

It looks to me that whatever it is you are using to open 50B_1832 - Copy.tif thinks it is a tif file.

It looks to me that whatever it is you are using to open 50B_1832 - Copy.nef thinks it is a nef file.

StarGeek

Quote from: Chris Walton on January 17, 2020, 12:54:10 PM
I removed one group of exif data from a NEF file with:
   exiftool.exe -HierarchicalSubject= "50B_1832 - Copy.NEF"

You are assuming that HierarchicalSubject is EXIF data.  It is not.  Understand that EXIF is only one type of metadata, there are many, many other types of metadata.  HierarchicalSubject is part of the XMP group of metadata, which pretty much can be edited freely as it is not data that is required to display an image.  At least, it shouldn't be. 

See the EXIF tag name page for a list of the tags in the EXIF group, not counting the GPS tags, which are also part of the EXIF specification.

Quoteattempting to open the second file results in an error similar to:
   Warning! The file 50B_1832 - Copy.NEF_original is a TIF file with incorrect extension ! Rename ?
irrespective of renaming or not, continuing with the file open shows a preview image (160x120 pixels - much smaller than the thumbnail embedded in the pre-change photo)
if the file is renamed it becomes 50B_1832 - Copy.tif
if the tif file is renamed to 50B_1832 - Copy.NEF it corrects the apparent corruption, leaving a usable normal image

Most RAW file types are proprietary formats largely based upon the TIFF specification.  When you try to access the "_original" image, what ever program you are using has to try to decide what the file type is based upon the format of the file rather than the extension.  Since NEFs are TIFF based, the only thing it can do is assume it is a TIFF file.  Since it is not, it cannot be properly rendered as a TIFF.  You would probably run into the same problem if you were using an "_original" file that was a .CR2.

QuoteI thought at first that the _original file was corrupted. This would imply that the copy operation was destructive, while the modification operation was safe.

The original file has not been altered.  If you remove the "_original" (or use the -restore_original option), you should find that it can now be loaded into your program, as it can be properly identified as a NEF, not a TIFF.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Chris Walton

StarGeek said:

QuoteYou are assuming that HierarchicalSubject is EXIF data. ....

Yes I was making this assumption.

Quote
Most RAW file types are proprietary formats largely based upon the TIFF specification. .......

I was not aware that this was how NEF files worked.

Thank you for your explanation - I am much less muddle-headed than before.