Postprocessing like raw viewers

Hi there,

Thank you for all the hard work that you're putting into the development and support of LibRaw. We're already successfully using LibRaw in our project for extracting metadata.

We're currently trying to decode raw files in order to show it to end-users. At the moment, we're just setting the following output parameters:

gamm[0] = 1.0 / 2.4;  // sRGB gamma
gamm[1] = 12.92;
use_camera_wb = 1;

The colors seem a bit washed out for most images we've tried when comparing this to the rendering of raw viewers (like FastRawViewer, LightRoom, Mac OS Preview, etc).

Which other parameters should we set or what postprocessing should we do to make it roughly similar?

Thank you!

Stijn Seghers (Narrative)


LibRaw::dcraw_process output

LibRaw::dcraw_process output is close (enough) to FastRawViewer in fixed contrast + auto ETTR mode.

-- Alex Tutubalin @LibRaw LLC

Thanks for the quick reply,

Thanks for the quick reply, Alex.

The fixed vs variable contrast indeed seems to be the major contributing factor to the difference. I'm not familiar with that terminology; could you explain what variable contrast mode does? Can LibRaw emulate it?

dcraw.c's postprocessing

dcraw.c's postprocessing (LibRaw::dcraw_process is derived from it) do not have contrast controls.

-- Alex Tutubalin @LibRaw LLC


Thanks for your help, Alex. We'll try to figure out how to apply such a variable contrast transformation ourselves then.

Any progress?

Hey, I would also be interested in this topic of how to prepare a "good" visual representation of a RAW file automatically (similar to what FastRawViewer, RawTherapee, etc are doing). Using only dcraw_process() is not enough. I know in the documentation it also says that you should probably write your own algorithm. Is there any literature or open source examples of a "good enough" implementation that produces better results? Especially the exposure seems to be missing in the processing. Take a look at this example, where the top row are original RAW files as seen through FastRawViewer and the bottom row are the images created with dcraw_process(). You can hardly see the difference between the three exposures.

We ended up applying camera

We ended up applying camera-specific tone curves that match the embedded thumbnail after LibRaw has finished processing it. It seems to work pretty well. We took inspiration for that from how darktable does it. (darktable is open source so you can check the code if you're interested.) I'm guessing the variable contrast mode in FastRawViewer is doing something similar.

Good luck!