rawpy icon indicating copy to clipboard operation
rawpy copied to clipboard

Adobe DNG GainMap support

Open StudioPetrikas opened this issue 2 years ago • 5 comments

Hello, First of all - thank you for your work on this excellent tool.

Just wanted to ping regarding Adobe DNG GainMap support.

If you aren't familiar - it is something that is usually added to DNGs produced by smartphones. It's basically a per-channel lens correction, that gains the data based on the embedded 2D image. This helps tremendously with Vignetting and hue shifts produced by the tiny lenses in smartphones.

It also helps with pink highlight issues (with highlight reconstruction)

Here's the Adobe DNG spec, page 94: https://www.kronometric.org/phot/processing/DNG/dng_spec_1.4.0.0.pdf

It comes up as Opcode List# in Exif info. Thank you so much once again!

StudioPetrikas avatar Dec 03 '23 15:12 StudioPetrikas

Since rawpy is built on libraw, a first step would be to ask in https://www.libraw.org/forum/15 whether libraw supports it, and if not, if support for it can be added.

letmaik avatar Jan 29 '24 23:01 letmaik

Understood. I will create a thread on the forum. Thanks!

StudioPetrikas avatar Jan 30 '24 09:01 StudioPetrikas

Got a reply from Alex Tutubalin:

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

Process Stage2/3 only if OpcodeList2/3 present: LIBRAW_RAWOPTIONS_DNG_STAGE2_IFPRESENT,LIBRAW_RAWOPTIONS_DNG_STAGE3_IFPRESENT

Forced Stage2/3 processing: LIBRAW_RAWOPTIONS_DNG_STAGE2 and LIBRAW_RAWOPTIONS_DNG_STAGE3

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

I can't make much sense of it, is this something that rawpy could use?

StudioPetrikas avatar Feb 01 '24 17:02 StudioPetrikas

I'm afraid I won't have time to look into this myself. The dependency on the Adobe DNG SDK might be a problem.

letmaik avatar Feb 01 '24 21:02 letmaik

Related: https://github.com/letmaik/rawpy/issues/207

letmaik avatar Feb 01 '24 21:02 letmaik