Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Alpha compositing
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Gamma correction == [[File:Mix lazy.png|thumb|Alpha blending, not taking into account gamma correction]] [[File:Mix precise.png|thumb|Alpha blending, taking<br> into account gamma correction]] The RGB values of typical digital images do not directly correspond to the physical light intensities, but are rather compressed by a [[gamma correction]] function: : <math>C_\text{encoded} = C_\text{linear}^{1/\gamma}</math> This transformation better utilizes the limited number of bits in the encoded image by choosing <math>\gamma</math> that better matches the non-linear human perception of luminance. Accordingly, computer programs that deal with such images must decode the RGB values into a linear space (by undoing the gamma-compression), blend the linear light intensities, and re-apply the gamma compression to the result:<ref>{{cite web|url=https://www.youtube.com/watch?v=LKnqECcg6Gw| archive-url=https://ghostarchive.org/varchive/youtube/20211122/LKnqECcg6Gw| archive-date=2021-11-22 | url-status=live|title=Computer Color is Broken|author=Minute Physics|date=March 20, 2015|website=[[YouTube]]}}{{cbignore}}</ref><ref>{{cite web |title=What every coder should know about gamma |url=https://blog.johnnovak.net/2016/09/21/what-every-coder-should-know-about-gamma/ |last=Novak|first=John|date=September 21, 2016}}</ref>{{Failed verification|date=October 2022}} :''<math id="C_o = \left(\frac{ C_a^\gamma \alpha_a + C_b^\gamma \alpha_b (1 - \alpha_a) }{\alpha_o}\right)^{1/…" qid="Q281055">C_o = \left(\frac{ C_a^\gamma \alpha_a + C_b^\gamma \alpha_b (1 - \alpha_a) }{\alpha_o}\right)^{1/\gamma}</math>'' When combined with premultiplied alpha, pre-multiplication is done in linear space, prior to gamma compression.<ref>{{cite web |title=Gamma Correction vs. Premultiplied Pixels – Søren Sandmann Pedersen |url=http://ssp.impulsetrain.com/gamma-premult.html |website=ssp.impulsetrain.com}}</ref> This results in the following formula: :<math>C_o = \left( C_a^\gamma + C_b^\gamma (1 - \alpha_a) \right)^{1/\gamma}</math> Note that the alpha channel may or may not undergo gamma-correction, even when the color channels do.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)