Main Menu

swap linearization table

Started by spark, June 15, 2011, 09:15:09 AM

Previous topic - Next topic

spark

Hi everybody,

I'm trying to repair a few corrupted D90 NEF Files and am prety certain that the linearization table is the problem.
I'm looking for a way to swap the linearizion table with one from a non-corrupted NEF. What i want to avoid is loosing/swapping all other Metadata.

Any ideas?

Phil Harvey

I have made this not writable.  I'm not sure why I did this instead of just protecting it, but you could try editing Pentax.pm and changing "Writable => 0" to "Writable => 'undef'" for this tag.  Doing this will allow you to copy the value from another file with

exiftool -tagsfromfile src.nef -nikon:linearizationtable dst.nef

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

spark

Hi Phil,

i tried your suggestion and i believe you meant the Nikon.pm instead of the Pentax.pm, as i'm dealing with Nikon D90 Nefs.
In said Nikon.pm for tag 0096 i changed "Writable => 0" to "Writable => 'undef'" (Found the file in Temp Folder of Windows).

Since i work with shortcuts i used the following syntax:
-tagsfromfile C:\path\src.nef -linearizationtable

Per drag & drop i moved the dst.nef onto the shortcut. Unfortunately the change in the Nikon.pm didn't seem to do the trick, since the message "Warning: Sorry, linearizationtable is not writable" was given to me.

Any more ideas?

Phil Harvey

#3
You're right, Nikon.pm, sorry.

Oh yes.  I forgot that all writable tags need an entry in TagLookup.pm.

Add the following line to the %tagLookup definition (assuming you are running version 8.59):

'linearizationtable' => { 161 => 0x96 },

If you aren't running version 8.59, replace "161" with the index of 'Image::ExifTool::Nikon::Main' in @tableList (and have fun counting the entries!).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

spark

Phil... you're the man!!!
NEFs are fixed now and the world seems to be a happy place again :D
Thanks again for the help and be certain that a donation will follow at some stage soon (payday is nigh).

As a suggestion for future versions of Exiftool, why not make linearizationtables writable by default?

;)-Sascha

Phil Harvey

#5
Hi Sascha,

I think this is a reasonable suggestion.  I'll make these writable (but protected) for the next release.

- Phil

Edit.  I'll have to think about this some more.  Upon investigation I see that there is a DNG LinearizationTable tag which stores similar information but is formatted differently.
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Phil Harvey

OK, I have a solution:  To avoid the conflict with DNG LinearizationTable I will rename the Nikon version to NEFLinearizationTable when I make it writable.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).