How is dng file rendered on RT?

I select Neutral to avoid any other processing. I save a png from dng on RT with linear output gamma. PNG image gets the right luminance of orignal raw. But dng seems more bright than png. So I think some tone curve like process has been applied to preveiw on RT to get proper visual luminance. I don’t know whether I am right, so I’m here.

You can upload files to filebin, google drive, dropbox, or any number of file sharing platforms.

Thanks for your suggestion. I will upload DNG sample later.

Here is a DNG sample.

Open it with RT.

Save png image setting output profile with linear gamma. The luminance is not match with RT.

I think the problem is incompatibility of PNG format with exif and icc data. RT does not write/read the iic data when exporting/opening PNGs and auto applies sRGB primaries and gamma 2.2 at opening.

I would suggest using (compressed) tiffs when exporting … which are fully compatible with icc data.

For the existing PNGs you can apply as custom profile the profile which you used for exporting and then the rendering will be correct :wink:

I received some times ago PNG from a friend . I was surprised that no exif data was present.
After googling, I found that PNG does’nt support standard way to embed exif data and that some programs (perhaps exiftool) can use a proprietary way to write exif data in PNG data chunks.
So if PNG is not mandatory, I would follow Ilias_giarimis suggestion.

Thanks for your help. You mean when opening DNG with RT, gamma 2.2 is applied for preview ? If it’s true, how can I disable this default gamma to get what png looks like.

Another problem confusing me is ProfileToneCurve Tag, I add a linear tone in this tag for uploaded DNG sample, but if let this Tag be default, it seems different with linear tone. So what is default value for this Tag?

I know PNG has no exif data. What I’m confused is how DNG rendered by different RAW editor/viewer. I did some comparison that open DNG with RT and Adobe DNG Converter, at least they looks have some difference. Actually I’d like to know exactly how image data is processed when opening DNG and how DNG Tags take effect. I have read DNG Spec, but some tags’s description is too simple, I still can’t understand all.

No, on DNGs (and tiffs/jpegs with linear gamma and correct icc data) no gamma correction is applied. This gives the correct rendering i.e. mid grey at L=50 (see Lab values)
On linear PNGs and tiffs/jpegs with wrong icc data RT applies gamma correction and this gives wrong rendering (darkened).

DNG’s tag “ProfileToneCurve” is not related with the raw data but with the (possibly embedded in DNG exif) dcp profile. It is optional and not needed for a neutral rendering. Adobe usually uses a contrast curve at this place … in RT you can see what it looks like if you use a dcp profile as input color profile and check the “tone curve” box.

About your sample …

  • It is better to not prescale R,G,B in order to get WBalanced rendering (you get unneeded clipping) leave them unscaled and use the correct AsShotNeutral values.
  • You have a lot of clipping at highlights in the RAW data, is it due to overexposed shot or due to scaling ?
  • Your data look like 12bit scaled to 16 bit … no need to do any scaling … just define a correct black level (i.e around 4095 for 12-bit) and black level (measure a black frame for this …or leave in tact any optically black area if exists and define the black_area and the useful active frame (raw_crop) in camconst.json)

Thanks for your patient explanation.

For a DNG file icc data means DCP? I didn’t input dcp file so RT applies gamma to DNG as start point, is it right?
Because DNG is always more bright than camera raw data on RT. I think the PNG sample shows the right camera raw data luminance. If no any gamma applied to camera raw, it should be same with PNG as a start point.

As you said , I make a dcp profile and check the “tone curve” box, it works well. DNG contains a lot Tags names prefixed with “ProfileXXXX”. Are all these Tags only effective when they are included in a DCP file? If they don’t effective in a DNG file, so it’s not necessary to add it in DNG.

For my sample,in fact I have preprocessed it as you said. Thanks for your suggestion.

Again NO, RT does not apply any gamma correction on RAW files … assumes linear data and renders mid gray as L=50. And this is the correct neutral rendering. Expose carefully your cc24 target and compare with the reference L values

In the case your RAW values are not linear you have to define a “Linearization table” … see page 26 & 77 in DNG 1.40 specs

OK. For cc24 the 22th patch (row 4 column 4) is mid gray, If I expose it to match Xrite’s reference value, I can get this patch L = 50, right ? But how RT know which value is mid gray for an given DNG?

They have named that patch neutral 5. According to xrite, it is L=50.867 a=-0.153, b=-0.27. Or 122, 122, 121 in sRGB.

No need to be exact, but you need homogeneous lighting. In your sample there is a bit of light fall off from right to left and maybe a bit of glare which increases the brightness of the dark patch …
Even so, if we set raw linear correction at 0.85 the neutral grey patch is perfectly neutral (L=51) now we check all the grey patches . we have 26, 37, 51, 66, 79, 91 … very close to the reference except from the dark patch. And a more careful shot will be closer. This tells me that your RAW data are linear and no tone curve is needed.
Apply a tone curve and you destroy this linearity … measure your PNG :wink:

I got a clue from google about how LR work with DNG. I think RT might work similar to LR.

“linear image data look terrible - very dark and flat”

here we must add " when treated like if they are gamma encoded" … just like your PNG … because in this case a gamma correction is applied which darkens and flattens the displayed picture.
Linear data need no gamma correction and this is what happens when the linear file includes icc data describing the correction needed. Open with icc inspector the output profiles RTsRGB_g10.icc and RTsRGB.icc and see the correction curves, for the first it is a straight line, for the second it is a concave curve which darkens-flattens darks and midtones …


May be we have different understandings of “Linear”. In my opinion, sensor raw data is linear, but sRGB color space is non-linear(with sRGB gamma curve). Have a try with my DNG sample, if we set output profile as RT_sRGB, then save a png image, we get what is almost same with DNG looks like opened by RT. If we set output profile as RT_sRGB_g10, save a png, then we get linear image, as my uploaded png seems. Their difference is an sRGB gamma curve applied in RT_sRGB. Actually sRGB gamma curve is convex curve which make image more bright. I think RT_sRGB.icc Curve Tag is a description of output device curve, which means we have to apply a convex curve to compensate the concave curve. Otherwise we can’t explain why RT_sRGB.icm make image more bright than RT_sRGB_g10.icm.

We agree on all the above except

… it looks more bright because the PNG (additionally to what you mention), is wrongly treated as gamma encoded due to PNG’s incompatibility with icc data. If you export in icc compatible format (tiff/jpeg) both linear and gamma encoded will correctly be rendered equally bright …

1 Like

@Christian : I already brought your attention on the fact that you cannot use PNG format to render photos (unless you are aware that it is not color managed). It makes you take false conclusions. Use Tif or jpeg for photos and use PNG for icones or graphical art if you want.

1 Like

Thanks for your help:smile: