Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

- Adobe Support Community
- :
- Camera Raw
- :
- Re: What is the transfer function for DNG monochro...

What is the transfer function for DNG monochrome images?

So I have finally figured out how to create linear raw monochrome DNG images that Photoshop can actually load (me trying to figure out how to do that was the topic of this thread What are the minimum required tags for a DNG file? ) but now I notice something unusual. Photoshop (or at least the Camera Raw plugin) doesn't use the transfer function I was expecting to convert linear raw monocrhome values to standard grayscale values that are ready to be displayed. I assumed that it would use the gamma 2.2 transfer function (like that used in sRGB and sGray color spaces), but it doesn't. Instead, it uses something drastically different. After creating a test monochrome DNG image with dimensions 256x256, and bit-depth of 16bpp, I loaded it into Photoshop with the Camera Raw plugin. For the Camera Raw settings, I disabled all of the raw processing options (Exposure, Contrast, etc controls on the "Basic" tab, all set to 0, and all sharpening and noise reduction values on the "Detail" tab, also set to 0), and the Process (on the "Camera Calibration" tab) set to "2012 (Current)". The test image had one pixel at each possible 16bit value, so that for the entire 256x256 image, all possible 16bit values were in present.

After loading it into Photoshop, I then proceded to convert it to Grayscale (since it loads as an RGB image, even when it's a monochrome DNG image file). I then saved it as an uncompressed TIF file, and used a hex editor to extract just the portion of the file that was the bytes of image data and saved this to a new file (I couldn't save as raw image byte array from Photoshop directly, because I'm using Elements). I then wrote my own program that compared those values, to the the linear raw values, and graphed the resulting curve. This allowed me to visualize the transfer function that Photoshop was using. I also did the same thing with the sRGB/sGray transfer function (which is a piece-wise function that is very close to being output=input^(1/2.2) but not quite, where part of it is a power function, and part of it is linear), as well as the actual gamma function with output=input^(1/2.2). I displayed all 3 of these curves on the same graph, and was amazed at just how FAR AWAY the Photoshop monochrome DNG transfer function was from the standard gamma function. Sadly, I don't know the actual equation used here, and I just hope that it isn't proprietary. I was able to get a fairly close approximation to it by using the ATan (inverse tangent) function. The equation I came up with that approximates it is:

output=ATan(input / 8986.905) * 45684.399

And the fact that the main function of ATan happens to work I found just by trial and error. I also tried various power functions and logarithms. I don't think the actual function Photoshop is using is based on ATan, it's just that ATan closely mimics Photoshop's transfer function here. If somebody here knows the actual transfer function that Photoshop uses for converting monochrome linear DNG image files to standard grayscale images, please let me know.

And by the way, I've included a picture of the graph that I had generated showing 3 different transfer functions.

The black line is the one Photoshop is using.

The red line is the the sRGB/sGray transfer function

The blue line is the power function: output=input^(1/2.2)

And here's the comparison of Photoshop's transfer function, and the transfer function I came up with after about an hour or two of trying different base functions and different values for multipliers.

The black line is the transfer function that Photoshop is using

The red line is the one I came up with after an hour or two of trial and error: output=ATan(input / 8986.905) * 45684.399

Again, if anybody can tell me what transfer function Photoshop is using here, please let me know. Thanks in advance.

Topics

View all replies

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn More

What is the transfer function for DNG monochrome images?

So I have finally figured out how to create linear raw monochrome DNG images that Photoshop can actually load (me trying to figure out how to do that was the topic of this thread What are the minimum required tags for a DNG file? ) but now I notice something unusual. Photoshop (or at least the Camera Raw plugin) doesn't use the transfer function I was expecting to convert linear raw monocrhome values to standard grayscale values that are ready to be displayed. I assumed that it would use the gamma 2.2 transfer function (like that used in sRGB and sGray color spaces), but it doesn't. Instead, it uses something drastically different. After creating a test monochrome DNG image with dimensions 256x256, and bit-depth of 16bpp, I loaded it into Photoshop with the Camera Raw plugin. For the Camera Raw settings, I disabled all of the raw processing options (Exposure, Contrast, etc controls on the "Basic" tab, all set to 0, and all sharpening and noise reduction values on the "Detail" tab, also set to 0), and the Process (on the "Camera Calibration" tab) set to "2012 (Current)". The test image had one pixel at each possible 16bit value, so that for the entire 256x256 image, all possible 16bit values were in present.

After loading it into Photoshop, I then proceded to convert it to Grayscale (since it loads as an RGB image, even when it's a monochrome DNG image file). I then saved it as an uncompressed TIF file, and used a hex editor to extract just the portion of the file that was the bytes of image data and saved this to a new file (I couldn't save as raw image byte array from Photoshop directly, because I'm using Elements). I then wrote my own program that compared those values, to the the linear raw values, and graphed the resulting curve. This allowed me to visualize the transfer function that Photoshop was using. I also did the same thing with the sRGB/sGray transfer function (which is a piece-wise function that is very close to being output=input^(1/2.2) but not quite, where part of it is a power function, and part of it is linear), as well as the actual gamma function with output=input^(1/2.2). I displayed all 3 of these curves on the same graph, and was amazed at just how FAR AWAY the Photoshop monochrome DNG transfer function was from the standard gamma function. Sadly, I don't know the actual equation used here, and I just hope that it isn't proprietary. I was able to get a fairly close approximation to it by using the ATan (inverse tangent) function. The equation I came up with that approximates it is:

output=ATan(input / 8986.905) * 45684.399

And the fact that the main function of ATan happens to work I found just by trial and error. I also tried various power functions and logarithms. I don't think the actual function Photoshop is using is based on ATan, it's just that ATan closely mimics Photoshop's transfer function here. If somebody here knows the actual transfer function that Photoshop uses for converting monochrome linear DNG image files to standard grayscale images, please let me know.

And by the way, I've included a picture of the graph that I had generated showing 3 different transfer functions.

The black line is the one Photoshop is using.

The red line is the the sRGB/sGray transfer function

The blue line is the power function: output=input^(1/2.2)

And here's the comparison of Photoshop's transfer function, and the transfer function I came up with after about an hour or two of trying different base functions and different values for multipliers.

The black line is the transfer function that Photoshop is using

The red line is the one I came up with after an hour or two of trial and error: output=ATan(input / 8986.905) * 45684.399

Again, if anybody can tell me what transfer function Photoshop is using here, please let me know. Thanks in advance.

Topics

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn More

4
Replies

Re: What is the transfer function for DNG monochrome images?

View all replies

Community Guidelines

Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn More

Reply

Loading...

Re: What is the transfer function for DNG monochrome images?

Since I'm using Photoshop Elements I don't have much control over color space. However, I have switched it to "No Color Management" in the dialog box that comes from pressing ctrl+shift+K. I believe what is being saved in the TIF file is a direct memory dump of the image-bytes in Photoshop (same as when saving RAW as you could do in normal Photoshop, but that I can't do because I have Elements), and not any kind of color profile or color space based color conversion of those bytes.

After running exiftool on the TIF file though, I notice something interesting in the metadata it was able to pull.

Tone Curve Name | : Medium Contrast |

Tone Curve | : 0, 0, 32, 22, 64, 56, 128, 128, 192, 196, 255, 255 |

I don't recall seeing any Tone Curve in any settings, so this may be something that would normally be available to configure in settings in Photoshop, but because I'm using Elements it is hardcoded into the program. I'm not exactly sure though what the curve algorithm is. However, it may just be a piecewise linear curve, as it appears contain an even number of entries, that appear to be number pairs (each entry is somewhat close to the number next to it, like 0,0 and 64,56). I'm not sure if this tone curve is the only thing that is producing the results I noticed with Photoshop's transfer function, or if it's just one of several steps in computing the transfer function.

Community Guidelines

Reply

Loading...

Re: What is the transfer function for DNG monochrome images?

Community Guidelines

Reply

Loading...

Re: What is the transfer function for DNG monochrome images?

Community Guidelines

Reply

Loading...

Community Help
Experience League
Terms of Use
Privacy Policy
Cookies
AdChoices
Language:

- Deutsch
- English
- Español
- Français
- 日本語
- Português

Copyright © 2019 Adobe. All rights reserved.