Adobe DNG Gainmap support or extraction

Since this is my first message on the forum, I would like to thank you for the brilliant LibRaw library that has enabled a bunch of different great uses.

On of them is developing Adobe DNGs, produced by smartphones.

However, many, if not all phones, use something that is called a "GainMap", basically a per-channel lens correction, that gains the data based on the embedded 2D image. This helps tremendously with strong Vignetting and hue shifts produced by the tiny lenses in smartphones.

I would love to have a way to either 'enable' or 'disable' it, or, worst case, extract it somehow. Could this be considered?

Page 115 of the Adobe DNG spec:

It comes up as Opcode List# in Exif info.

Thank you very much in advance.


Assuming you're talking about

Assuming you're talking about OpcodeList#, not ProfileGainTableMap (introduced in DNG 1.6).

If LibRaw is compiled with Adobe DNG SDK: it is possible to process via DNG Stage2/Stage3 by specifying corresponding rawoption bits:


Forced Stage2/3 processing: LIBRAW_RAWOPTIONS_DNG_STAGE2 and

If one want to extract specific DNG/TIFF/EXIF tags: use exifparser_handler to setup own callback function.

-- Alex Tutubalin @LibRaw LLC

Thank you very much for the

Thank you very much for the reply. Hopefully this is what I'm looking for.
All the best.