POV-Ray : Newsgroups : povray.beta-test : PNG output much brighter than preview... : Re: PNG output much brighter than preview... Server Time
29 Apr 2024 05:33:10 EDT (-0400)
  Re: PNG output much brighter than preview...  
From: Daniel Nilsson
Date: 15 Jan 2007 18:00:09
Message: <45ac0779$1@news.povray.org>
[Followup-To set to povray.general as this isn't really about the 3.7 
beta anymore]

Take this as my vision of a future, prefect, gamma corrected world and 
not so much of a solution for today's gamma problems ;)

Warp wrote:
>   Gamma correction in PNG causes lots of problems. For instance, if
> you want to make a web page with a certain backtround color and add
> a PNG image which uses that exact same color, you can blame gamma
> correction for the fact that often you won't. While you can do that
> with any other image format, and the image will match the background
> color in the web page perfect, with PNG it often won't. It depends on
> the browser. Some browsers read the gamma correction, others don't.
> If there's no gamma correction, some browsers will guess a gamma
> correction (screwing up the colors) while others will take the pixels
> unmodified.

This may be true, I have not experienced it myself, though. In theory I 
don't think it should be a problem if browsers implemented gamma 
correction correctly. What I mean by that is that they should correct 
both images and colors specified in css (assuming they are specified in 
sRBG I guess, which seem to be the de facto standard). In practice 
browsers don't do this of course and and I doubt that css (or any other 
w3 standard) defines any gamma correction, so they probably never will.
You still need embedded gamma information (or standardized gamma) if you 
want an image to look the same regardless of the target system's gamma. 
I believe that is an important thing for CG-art.

>   Other image formats simply don't have these problems. If you use
> a certain color in a gif or jpg or whatever, you will get that certain
> color, and it will perfectly match the same color used in the background
> of the web page. With png you might or might not get the color you want.
> In one browser it may look good, in another it may not.

With gif (or others) you get the pixel value you want, with png (with 
embedded gamma) you get the perceived color you want. In web pages the 
former is more important (because browsers don't gamma correct css 
colors) and when showing the image to others the way it's supposed to 
look the latter is more important. It all depends on what the image's 
purpose is.

>   The PNG standardization organization screwed up. They gave unwise
> rules on what to do when a png file has no gamma information. Some
> programs follow this rule, others don't. What is worse, if there *is*
> gamma info, some programs will read it, others won't. Thus you might
> get even 4 different results depending on the gamma info and the
> program.

(I have not studied the PNG-standard closely so IIUC...)
Fact remains that if all programs followed the standard's rules 
regarding gamma (unwise or not), any given png-image would look the same 
regardless of the target system. As I see it the problem is that 
programs don't follow the standard. In practice you can't (easily, if at 
all) fix the programs so you have to find some workaround. I don't have 
any solution but it is not a good idea to remove gamma support from 
programs that have it (e.g. povray).

>   In my personal experience the least problematic course of action is
> to not to include any gamma info in the png file. While that will not
> guarantee anything (some programs may start "guessing" a gamma info
> for it even if you don't want it to), I think most programs will then
> just take the pixels as they are, in the same way is with any other
> image format.

As you can see from my posts I am sort of a fan of gamma correction, but 
I'm more of a theoretical guy, not doing much raytracing and image 
related work right now. I once started writing my own raytracer and that 
was when I encountered gamma first. After reading many articles on the 
web I understand how it works and why it is needed. I think it's a 
necessary evil, in a perfect world we would only use gamma 1.0 with 
floating point values. It's non-linear hardware and the limited dynamic 
range of 8-bit values that force us to use gamma correction and the fact 
that different manufacturers chose different factors that make it a 
PITA, IMHO.

--
Daniel Nilsson


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.