Skip to content
0:00 / 0:00

#gammacorrection#srgb#colorblending

Computer Color is Broken

minutephysics

5.9M subscribers • 5 videos on Hallway

YouTube
  • Recommended by 5 people: 4 on Hacker News and 1 in engineering communities.
  • A classic. People kept recommending it from 2015 to 2026.

Beginner. No background in the topic needed.

4.2M views11 years ago5 recommendations

Graphics and audioRenderingCreative coding

MinutePhysics explains why blending and blurring colors in non-linear RGB space leads to dark, incorrect results and how gamma correction works.

Thanks to audible.com/minutephysics for supporting this video! MinutePhysics is on Google+ - bit.ly/qzEwc6 And facebook - facebook.com/minutephysics And twitter - @minutephysics Minute Physics provides an energetic and entertaining view of old and new problems in physics -- all in a minute! Music by Nathaniel Schroeder soundcloud.com/drschroeder This video made possible by the following Patreon Supporters: Mark Wes Brown John Green Florian Philipp Rens van der Heijden Bob Bolch Daniel Ametsreiter Joël Quenneville Richard Pearson David Dailey Steven Mulder Karim Ethi Raj Ryan Kyle William Ricketts Collin Mandris Matt Jonathan Foster Siddharth Sadanand Maarten Daalder Robby Olivam Alan Browning Jonathan Piersa Julia Person James Craver Sarah Chavis Yonatan Bisk Richard Campbell Chris Barrett Jan A Christopher Coleman Daniel “YoureDown” Breger Hendrik Payer Daniel Yip Matt K William Pearson Kevin Lynch Nick Ward Kevin john eriksson Allan Farrell Tobias Olesen Chris Chapin Michael Keefe Jon Mann Bert Goethals Joji Wata Adam Naber Rob Ibsen Jacob Gumpert Peter Collier Andi Davis Aarthy Raymond Cason Evan Gale Paul Tori McClanahan Andrew Stobie Dominik Steenken Danilo Metzger Christian Altenhofen Ezra Lee Roy Morgan Olivia Darroch Amber Ciarvella ryan horlacher Keith Chang Milokot Janel Christensen Will Scherer Mike Fulcher Larom Lancaster Liam Callaway John Harman Christos Papandreou Fernando Pazin Johnathon Kinville Jason Medrano Andrew Barnett Katharina Schuchmann John Gietzen Michael Tardibuono Matthew Hebert Christy Filipich Pierre-Louis Bourgeois Genevieve Lawrence Brian D'Agostini Chris Dominik Menzi Ryan A. Schauer Daniel Johnson Nico Houbraken Michael Carr Ragnhild Elizabeth Meisterling Lysann Schlegel Magnus Krokstad Chase Turner Owain Blackwood Russ Arrell Brenden Bullock Asaf Gartner Mark Samberg Tina Johnston Mike Cochrane Tom Murphy Peter L Jeff Erica Pratt David Artur Szczypta David Drueding Nicklas Ulvnäs Nigel W James Nelson Mary Foster-Smith Clayton Neff Michael Merino Jason and Gayle Corfman Mihaly Barasz Steven Klurfeld Richard Bairwell Tamas Bartal Erven Justin Prahl Michael Maitlen John Harman Hans van Staveren Kasey Karlin Nazario M K Jacques LABBÉ Geralyn Byers jason black Candice Blodgett Daniel Gibbs Henry Berthelsen Andy Kittner Steve Hall Erdumas Rob Snyder John Kelly Jessica Rosenstein Bill Tomiyasu Vasco Simões Eoin Simon Hammersley iain Holger Alexis Carpenter Jay Goodman Joseph Perry Mark Govea Eduardo Rampelotto Gatto Created by Henry Reich

Why it's here

5 people recommend this, 1 disputes it

What people say. Highly recommended by developers as the clearest and most accessible explanation of gamma correction and color blending issues.

u/Pyrolisticalin r/GraphicsProgramming • Recommends

Computer Color is Broken

joedragoon Hacker News • Recommends

On “What every coder should know about Gamma Correction”

For those interested in this topic, I found minutephysics' treatment of this subject to be really pleasant and easy to grok. I had a talk I gave at work once or twice discussing color conversion and I would play a 90 second snippet from this (attributed appropriately) as it would very quickly crash course people on the reasoning behind an EOTF in a really cute and layman's terms kind of way: link to this video

mxfhon Hacker News • Recommends

On “What every coder should know about gamma”

Good reminder about these persisting blending issues in the linear interpretation of RGB values, which was well explained to non-coders as well here in a quite popular MinutePhysics video: link to this video As others commented the gamma scaling issues seem even more relevant. Just please, don't use RGB color space for generating gradients. In fact, it's ill fitted for most operations concerning the perception of colors as is. chroma.js : link D3 : link Interesting excursion: historically the default viewing gammas seem to have lowered, because broadcasting defaulted to dimly lit rooms, while today's ubiquitous displays are usually in brighter environments. link

quietbritishjimon Hacker News • Recommends

On “Brown: color is weird [video]”

If we're on the "watch this YouTube video if you work with colours" train, here's a great explanation of why gradients usually have a dark band in the middle, on the MinutePhysics channel: link to this video In short: the RBG values in an image are not actually the intensity of light, but some nonlinear function of intensity. To do a weighted average of two colours you need to first undo that nonlinearity, then do the averaging, then reapply the function. Most software doesn't do that so the colours end up wrong. This also applies to resizing images.

fireattackon Hacker News • Recommends

On “Ditherpunk: The article I wish I had about monochrome image dithering”

…ny gamma space would have problem with "averaging", as explained by the GP. Actually, it's so bad that almost all the image editing/representing tasks we have today are doing it wrong (resizing, blurring, mixing..). This topic has been discussed extensively on Internet, so I'm not going to go into detail too much. A good start point is 12. 1 link to this video 2 link…

quietbritishjimon Hacker News • Recommends

On “Rendering the Visible Spectrum”

…earlier and much more prominently. Instead, it's practically a footnote. Maybe I'm mistaken, but I would bet 90% of the awkwardness in the very first image is from averaging these values (R', G', B') for the gradients rather than switching to the true linear values, averaging, then converting back. This classic MinutePhysics video covers it well: link to this video…

anon4on Hacker News • Disputes

On “Mandelbrot Set with SIMD Intrinsics”

…s I can see nobody cares outside of people doing movie VFX and the like, where it is actually really really important that you get it right. Your GUI for example doesn't care - elements are blended assuming a linear colourspace, which means that all font rendering is just slightly off. Even Apple don't care to make their blur effects correct - see link to this video . Even photoshop doesn't do it correctly by default. Almost everybody is perfectly happy treating the values as linear colour intensity. The bottom line is that sRGB is hideously hard to work in. You really want to only use it for storage and only if you really must. It's an optimisation to allow you better range on the low end, at the expe…

qwertyuiop924on Hacker News • Mentions

On “What every coder should know about gamma”

I'd already seen most of this in a video (courtesy of Henry, aka MinutePhysics, link to this video ), but it was nice to see a programmer-oriented explanation, nonetheless.

sometimeon Hacker News • Mentions

On “Gamma error in picture scaling”

The same phenomenon also applies to color blending. In a modern context this phenomenon is especially visible in UI elements that blur the background: Up until recently many UIs did not get the blurring right, resulting in greyish dark spots between different colors. I think CSS blurring in most browsers still gets it wrong. link to this video (Computer Color is Broken, MinutePhysics)

vanderZwanon Hacker News • Mentions

On “Unveiling the first-ever image of a black hole [video]”

Mind you, that's a JPG you are editing, so in the 8 bit sRGB color space. That means manipulations can lead to errors and illusions due to the color space being non-linear and clipped0. The original data was likely linear and at a much higher precision. If the source was a 16 bit linear grayscale PNG for example you could be much more assured you're not seeing the effects of JPG compression and things that were actually measured. EDIT: Found better sources: 16-bit sRGB PNG: link 180 MiB original TIFF: link 0 link to this video

Akronymuson Hacker News • Mentions

On “The worst volume control UI in the world (2017)”

>This is in the same category of error as most programmers thinking that sRGB uses a linear light model. They try to do arithmetic like blending or blurring on the raw image data this inevitably does the wrong thing. Relevant: link to this video

circlingthesunon Hacker News • Mentions

On “CSS Gradients that avoid the “gray dead zone””

There is a related video by minute physics about how the RGB color space stores the square root of the brightness of each color channel, because human color perception is roughly logarithmic. Bad color blending is therefore pretty commonplace because it uses the average of square roots instead of the square root of the average of the original brightness values. See: link to this video

incrudibleon Hacker News • Mentions

On “Polychromatic Pixels”

I am not saying you can use the exact same math as in an image manipulation program, these work with different assumptions. Mixing colors in those is usually not correct anyway. link to this video I am saying you can think of subpixels, which already exist, as a form of dithering. Most displays use just three primaries for subpixels - red, green and blue. Their arrangement is fixed, but that is not a limitation of this new technology.