Google Pixel Raw Edit....

I came across this piece of discarded machinery on a hike this week. I thought it looked interesting. In any case I took a shot with my phone and I just thought I would share the original raw and the jpg from the phone as well as my raw edit.

If you want to see what you come up with compared to what the phone does go for it…:slight_smile:

I have also included a raw (*_pp.dng) processed by the dngpreprocess script provided by @paolod ( Smartphone DNGs and lens shading ). This applies the gain mapping to the DNG file and saves a new DNG file.
He is working on including the gain mapping in darktable. Many smartphones use it. Without it there is a really strong vignette and the colors can also be affected…this is not the best example but it works nicely…before that I cheated by using the lens profile for the Huawei P10 in DT…it did a very nice job on the pixel images and did not seem to distort them… ART supports the gain maps via the Flat field correction module.
The script does remove the embedded jpg so in RT and ART the Dng does not interact with the auto tone curve feature. You can process the files with a dcp file at the same time as adding the gain map …so this is another way you could prepare an image before sending it to DT…

Pixel 3aXL DNG
PXL_20211109_213513104.dng (10.8 MB)
Pixel 3aXL DNG processed with dngpreprocess
PXL_20211109_213513104_pp.dng (13.5 MB)

OOC Jpg Pixel 3aXL

My edit using the processed DNG…

This files are licensed Creative Commons, By-Attribution, Share-Alike.


Just to put this info out there: @heckflosse is working on this for RawTherapee: dng gainmap support #6379


could someone please provide an reference, where I can read, what gainmapping does in detail? I would like to understand it.


page 95

RT5.8 dev
PXL_20211109_213513104_pp.jpg.out.pp3 (14.7 KB)


google.pixel.raw.pp3 (17.6 KB) RawTherapee 5.8 Development.

1 Like

PXL_20211109_213513104_pp.dng.pp3 (15.6 KB)


Thanks a lot.

This sounds to me like a flatfield operation, which per se is not part of the firmware in digital cameras, as far as I know?


As far as I can tell, the issue is that the color sensitivity of the image sensor / color filters / microlenses varies according to the angle of the light rays hitting it. For typical mirrorless and DSLRs this effect is negligible and there is no need for any correction, but in tiny cameras like smartphones the effect is strong and must be corrected.

Okay, but where does one get the gain map from? This must be a calibration image?


This explains in more detail where it comes from on Android:

The calibration image originates in the camera driver, is provided to the camera app through the camera API and is stored in the DNG file. I don’t know exactly what the camera driver does to create it… maybe they measure each individual camera module at the factory or more likely just measure the camera model once. It probably takes into account focus distance, and it seems like it may also take into account the lens being shifted off center by optical image stabilization.

The most obvious is the vignette correction…my images above don’t show it that well maybe…looking here at a couple of screen shots…before and after in ART…Note the corners…

Then corrected with Gain Map

@priort @paolod

Thanks for the clarification.

So in the end it is some sort of flatfield calibration, if one takes this in a broader sense - not only for the detector but also for the optics (vignetting …).


PXL_20211109_213513104.dng.xmp (11.1 KB)

PXL_20211109_213513104_01.dng.xmp (11.9 KB)

1 Like

High-quality DSLR lenses often have special optical elements designed to minimize Shading (and have practically no Color Shading compared to phones).

Most phones typically have really high Luminance Shading because they don’t have that (from 50% to 80% – yes, 4/5 of the incoming light is not even hitting the sensor in the corners!), plus a lot of Color Shading because of the small sensor size and large aperture.