ExifTool is able to read tags from a bzip2 compressed TIFF file if the -z/-zip option is specified, but that option doesn't seem to work when using -TagsFromFile to copy tags from a compressed file to another file. Would it be possible to include support for this usage?
Interesting. I hadn't considered this usage. It could be a problem because expanding the .gz file is done by the application, but the -tagsFromFile feature is implemented by the underlying Image::ExifTool module. Perhaps something like this would do what you need:
exiftool -z -X SRCFILE | exiftool -tagsfromfile - DSTFILE
This extracts the metadata in XML and uses this as input for writing.
- Phil
Thanks for the suggestion. That seems to work, except that MakerNote tags (which I confirmed are included in the XML output of the first exiftool command) are not transferred into the destination file. Including "-all:all" or "-all:all -MakerNote" in the second exiftool command doesn't make any difference in this regard. Are there any other options here?
Makernotes tags may not be created individually, so you need to extract them as a block. The -api makernotes option will do this, but you also need to add -b to extract as binary. So try this:
exiftool -z -X -api makernotes -b SRCFILE | exiftool -tagsfromfile - DSTFILE
- Phil
Thanks for the suggestion. Unfortunately it doesn't work. With those extra flags, the XMP includes a binary-encoded tag ExifIFD:MakerNoteNikon3, but the makernotes are not properly included in the destination file metadata, which includes a warning
Warning : [minor] Bad NikonScanIFD SubDirectory start
This should work. What model of Nikon is it?
- Phil
The MakerNotes are written by the NikonScan utility for Nikon Coolscan scanners.
OK. Then I'll need a sample from you to be able to see what is happening. If you can email one to me I'll take a look: philharvey66 at gmail.com
- Phil
Thanks!
I've been trying to construct some small example images to email you (the originals are very large), but am having difficulty replicating the problem with the examples -- the suggested approach is only failing for the original images. At the moment I'm transferring the metadata from the original image to an example using
exiftool -tagsfromfile large_original.tif -all:all -makernote -b small_example.tif
but the output of exiftool -X -api makernotes -b is different for these two files, and the problem does not occur when using small_example.tif as the source image for the metadata copy. Is there some more complete way of copying the metadata from large_original.tif to small_example.tif?
I got your small example that gave a runtime error, and will patch ExifTool to include a test to avoid this runtime problem.
But I think I need the original to figure out why the makernotes aren't being copied. If it is too large for email, could you upload it somewhere?
- Phil
Will do.
I got the sample, thanks. It seems that ExifTool is not rebuilding the NikonScanIFD properly when copying the Nikon MakerNotes from this TIFF file. I'll look into this.
- Phil
This was difficult. I have fixed a couple of issues (related to the fact that the NikonScanIFD runs past the end of the makernotes block in the original file), but the NikonScanIFD still can't be preserved through the XML format. However, with the most recent version of ExifTool (12.19), you can do this:
gzip -dc SRCFILE.gz | exiftool -tagsfromfile -all:all -api makernotes DSTFILE
- Phil
Thanks for your help with this! So the problem boils down to NikonScan writing the tags in a way that breaks the TIFF format?
Using
gzip -dc SRCFILE.gz | exiftool -tagsfromfile -all:all -api makernotes DSTFILE
is a reasonable solution, but it does require uncompressing the entire source file. My impression has been that exiftool -z only uncompresses enough of it to read the metadata, but perhaps that's not actually the case?
Quote from: brendt on February 20, 2021, 03:53:53 PM
So the problem boils down to NikonScan writing the tags in a way that breaks the TIFF format?
Basically, yes.
QuoteMy impression has been that exiftool -z only uncompresses enough of it to read the metadata
Sometimes this is true (ie. If there is no indication that the file has a trailer containing metadata), but in general you should add
-fast if you don't want ExifTool to check for trailer information.
- Phil