ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: phodyssey on July 14, 2010, 09:56:44 PM

Title: EXIF APP1 segment too large!
Post by: phodyssey on July 14, 2010, 09:56:44 PM
When i copy exif tags from a .nef to a .jpg i sometimes gets this error:


Error: EXIF APP1 segment too large! (66134 bytes) - file.jpg
    0 image files updated
    1 files weren't updated due to errors


The problem comes from a huge NikonCapture group of tags. The html dump shows:
MakerNotes-45 NikonCaptureData : 47667 bytes

Of course i don't need these tags in the jpg version of the image. But i'm just unable to delete them without deleting all MakerNotes tags (which i want to keep!).

exiftool --NikonCapture:ALL -tagsfromfile file.nef file.jpg
Not a deletable group: NikonCapture

What is the solution?

Pho
Title: Re: EXIF APP1 segment too large!
Post by: Phil Harvey on July 15, 2010, 08:10:02 AM
This is unfortunate.  ExifTool tries to keep the maker notes intact, so it won't normally let you add or delete tags from the maker notes.  But in this case, I think the thing to do is to drop these tags when copying.  I will implement this in the next release (8.26).

To do this in your local version, just add the "Drop" line below to the NikonCaptureData definition in lib/Image/ExifTool/Nikon.pm:


    0x0e01 => {
        Name => 'NikonCaptureData',
        Drop => 1, # (may be too large for JPEG images)
        SubDirectory => {
            TagTable => 'Image::ExifTool::NikonCapture::Main',
        },
    },


- Phil
Title: Re: EXIF APP1 segment too large!
Post by: phodyssey on July 15, 2010, 01:08:06 PM
Thank you.

1) Copying from .nef to .jpg now drops NikonCapture which is fine (no more errors).

2) However, copying from a .nef to another .nef also drops NikonCapture. In general, i don't think this is desirable. NikonCapture tags appear in a .nef when saving in .nef format from Capture. It stores all modification steps you performed so that if you reopen the file later you can delete/modify your previous adjustments or just add some more. My guess is that if i ever want to copy tags between nef files, i will want NikonCapture tags to follow.

Simply dropping NikonCapture is sufficient for me (for now) since i always do 1) and mostly never 2). But some others might be hurt by 2) with the next release.

I think the default behavior for NikonCapture should be the same as JpgFromRaw: copy when destination is .nef and don't when destination is .jpg.

Thank you again,

Pho.
Title: Re: EXIF APP1 segment too large!
Post by: Phil Harvey on July 15, 2010, 01:32:09 PM
Hi Pho,

Thanks for your feedback.

Quote from: phodyssey on July 15, 2010, 01:08:06 PM
1) Copying from .nef to .jpg now drops NikonCapture which is fine (no more errors).

Thanks for testing this.

Quote
2) However, copying from a .nef to another .nef also drops NikonCapture.

Copying all tags from one NEF to another isn't a good idea.  Overwriting the makernotes in an NEF image with makernotes from another file will most certainly mess up the image white balance, etc.  However, in the upcoming release as well as adding "Drop" to this tag, I will make it block-writable so it can be copied into existing Nikon makernotes if desired.

Quote
I think the default behavior for NikonCapture should be the same as JpgFromRaw: copy when destination is .nef and don't when destination is .jpg.

Unfortunately ExifTool doesn't know what format image you are writing to when it decides to write a tag.  JpgFromRaw isn't written to a JPEG image because the format doesn't support it (it is found in the SubIFD, which doesn't exist in JPEG images).  So implementing this wouldn't be straightforward.

However, I don't think it is a problem.  People shouldn't be copying all tags between NEF images unless they really know what they are doing, and I will provide a block-writable NikonCaptureData tag for those experts that really need it.

- Phil
Title: Re: EXIF APP1 segment too large!
Post by: phodyssey on July 16, 2010, 10:03:48 PM
With some other files i had to do the same trick with another (Nikon) tag: 0x0e13.
On one file the value was 350k long!


    0x0e13 => {
        Name => 'NikonCaptureHistory',
        Binary => 1,
        Drop => 1,
    },


Pho.
Title: Re: EXIF APP1 segment too large!
Post by: Phil Harvey on July 17, 2010, 06:45:56 AM
Hi Pho,

Thanks.  I'll do the same thing for this tag in the next release.

- Phil
Title: Re: EXIF APP1 segment too large!
Post by: Phil Harvey on July 20, 2010, 02:25:22 PM
Sorry.  I forgot the NikonCaptureHistory change in 8.26.  It will have to wait until 8.27.

- Phil