开发者

Gamma-curve experiment -- convert 2.2 to opposite of 1.8?

The Motorola Photon is infamous for exhibiting what others have called "black crush" -- when viewing pictures, most of the detail in dark parts of the image is flattened out to black. Up to now, pretty much everyone has blamed it on the Pentile display. HOWEVER, the first time I ever saw the effect, a different thought occurred to me... "Wow, that looks the same (bad) way that pictures encoded for Windows used to look on Linux and Macintosh back when they used gamma of 1.8 instead of Windows' norm of 2.2". My theory is that somewhere along the line, Motorola built the Photon's Android using an old library written back when Motorola was a pre-iPhone Apple partner (or possibly, grabbed old open-source code that assumed 1.8 gamma instead of 2.2).

Why am I so sure? A few days ago, I did a screen capture of the same web page using both my old Epic 4G (Samsung Galaxy S) and my new Photon. Unexpectedly, the Epic's screen capture .png looked normal, but the Photon's screen capture .png had exactly the same bad appearance when viewed on my PC as it did when viewed on the Photon's screen. The moment I saw it, I remembered my earlier thought about a possible gamma-mapping 1.8-vs-2.2 bug, and decided to try and write a demonstration app to show Motorola and convince them that this is a real bug that CAN be fixed.

One experiment I'd like to do would be to take a JPEG image with high dynamic range and detail in both bright and dark areas, and re-encode it to a nonstandard gamma that's basically double the difference between 1.8 and 2.2. The idea is that if I intentionally mis-encode it to the opposite extreme (2.6?), then lie in the metadata and say it's 2.2, it will look normal when viewed on the photon (because the same error that crushes 2.2 down to 1.8 will crush 2.6 down to the proper 2.2).

So, two questions:

  1. What gamma would be equal and opposite the error you'd get if a 2.2 gamma image were decoded as though it were 1.8? 2.6?

  2. Is there any easy way (free Photoshop/gimp plug-in, JPEG encoding library, etc) to intentionally mis-encode a source image to that nonstandard gamma?

  3. 开发者_Go百科


When gamma is applied to an image, you start with linear values in the [0.0-1.0] range and raise them to the power of 1/gamma, which gives a result that is also in the [0.0-1.0] range. For a gamma of 1.8 you raise it by 0.56, and for a gamma of 2.2 you raise it by 0.45.

If you've applied a standard 2.2 gamma and you need a 1.8 gamma instead, you raise it again by the ratios of the two correction factors: 0.56/0.45 = 1.22.

Since pixel values are usually in the range of [0-255], you need to divide by 255 before the conversion and multiply by 255 when finished.

I'm not sure if Photoshop or Gimp can do this simply; I know Paint Shop Pro has a command for it.

The definitive resource for anything gamma related is Charles Poynton's Gamma FAQ.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜