Add new comment

The tone curve for DNG files

The tone curve for DNG files (Linearization Curve in DNG specs terms) is always applied on unpack() phase. There are no 'documented' options to turn this off (because RAW application always want to see linearized data), but you may use this trick:

LibRaw lr;
// Replace tone curve read from metadata by linear one:
for(int i=0;i<0x10000;i++)
// Do the unpack with linear curve:

This trick will work with data format with separate curve in metadata (all DNG files; Sony ARW2 format), but will not work with files where curve is calculated on unpack() phase (e.g. Nikon lossy NEF files).

Also please note, that raw2image() will skip 'masked pixels' (pixels outside of ActiveArea in DNG terms). To avoid this you may do the same trick: set imgdata.sizes.width and iwidth to raw_width and zero left_margin (and same with height, iheight and top_margin).

-- Alex Tutubalin @LibRaw LLC