E

Eric Brasseur

ericbrasseur.org · Personal blog · on HN since 2018

Eric Brasseur's personal site explains gamma errors in image scaling, and also covers glider physics and C++ for C users.

What HN saysHN links his gamma page as the standard explanation of why downscaling without linear-light correction darkens images. Commenters say even browsers get it wrong.
21HN people shared it
16linked it in comments
5stories submitted
65story points
5 months agolast shared
2018people per year2026

Most-shared posts

  1. 1
    Gamma Error in Picture Scaling
    8 people · 6 points · first shared 2019 · discussion on HN
  2. 2
    Gamma error in picture scaling
    7 people · 57 points · first shared 2018 · 33 comments on HN
  3. 3
    Gamma dalai lama
    2 people · first shared 2019
  4. 4
    C++ Tutorial for C Users
    1 people · 2 points · first shared 2022 · 1 comments on HN
  5. 5
    Gamma 1.0 or 2.2.png
    1 people · first shared 2024
  6. 6
    Intvac
    1 people · first shared 2019
  7. 7
    Glider physics
    1 people · first shared 2024

What HN people wrote when they linked it

bonoboTP · 2025-03-02
Since, you mention gamma, I have to link this: http://www.ericbrasseur.org/gamma.html?i=1 Also, side-by-side comparisons are hard, its best to flip back and forth between the two images, like opening them in an image viewer and pressing arrow keys. Or cross eyes like with magic eye stereograms so you see them "layered". But yes, more fundamentally, I think you're right that this is not really image content dependent, it doesn't need any image prior, if all you want is to minimize means squared error after upscaling with a fixed bicubic interpolation.
leni536 · 2024-06-20
> Not working in linearized space is a common error in pretty much any new OSS graphics project done by people who's background is not in computer graphics, I came across in the last decade. This still happens in mature software as well, including contemporary web browsers. Just open this image in your favorite browser and zoom out: http://www.ericbrasseur.org/gamma-1.0-or-2.2.png
meindnoch · 2024-02-09
The problem is simply that their downsampling is not gamma-corrected, so overall brightness is not preserved. http://www.ericbrasseur.org/gamma.html
planede · 2023-02-16
Point 2 is the most important one, and the most egregious error. Even most browsers implement it wrong (at least the last time I checked, I confirmed it again with Edge). Here is the most popular article about this problem [1]. Warning: once you start noticing incorrect color blending done in sRGB space, then you will see it everywhere. [1] http://www.ericbrasseur.org/gamma.html
colejohnson66 · 2021-12-16
A tangentially related trick involves gamma correction http://www.ericbrasseur.org/gamma.html https://superuser.com/q/579216
icantread1337 · 2020-12-20
Very cool. I wonder if gamma error [1] could take place here and affect the results [1]: http://www.ericbrasseur.org/gamma.html
metafunctor · 2020-10-29
I suppose a very stupid thumbnail generator could be attacked with something like this. Proper tools for downscaling images already take this (and also gamma correction) into account. See http://www.ericbrasseur.org/gamma.html
TeMPOraL · 2020-10-29
The article links to this browser test page: http://www.ericbrasseur.org/gamma_dalai_lama.html On my machine, both Firefox and Chrome display grey rectangles when scaling down. Why do the browsers get this wrong?
astafan · 2019-09-02
Integrated Vacuum Tube (IVT) could have been a thing... http://www.ericbrasseur.org/intvac.html
penteract · 2026-06-17
> What you want is 40% black onto white to have a similar difference in intensity as 40% white onto black, otherwise your darkmode font will look significantly different at the same intensity as your lightmode font. This is why it doesn't make sense to do it in a linear colourspace Thanks for putting this clearly. I had not given this argument enough thought and respect previously. Would you agree if I said this is about maximizing the amount of useful information given to the reader (even if it deviates from approximating a printed page) and a perceptual colour space is the way to measure that information? I should mention that I can find plenty of resources that suggest you should use a different font for dark-on-light vs light-on-dark (although I'm aware I'm not a good judge of the quality of said resources). This is not necessarily opposed to your point, since your reasoning can be extended to conclude that identically shaped printed text subject to blurring in linear colour space would be perceived differently depending on whether it's light-on-dark or dark-on-light (including when it's naturally blurred due to imperfect eyesight). > Note that the Wikipedia article is wrong, given that photoshop uses a nontrivial gamma exponent If we set text rendering aside, and consider something like games which prioritize photorealism rather than legibility, would you agree that linear colour space is the sensible one to do antialiasing in? This is for essentially the same…
virtualritz · 2022-11-02
Unfortunately mostly useless for professional applications. It fails the most simple test from [0] in the online demo[1]. ImageMagic also has a page about this[2]. I.e. also try the 'city lights' test with the online demo to see it fail for the same reason. The issue is that if you write code that deals with color you must understand color spaces and gamma. A non-linearly encoded color can't be plugged into any of the math you use to manipulate images and get meaningful results. Almost all code I come across in the Rust ecosystem (or elsewhere no less) treats color as linear. But color incoming from image files that are not RAW, EXR or some TIF variant is almost /never/ linear. The reason is that it is written by people who are (often very skilled) software developers but lack any basic understanding of color science. And then it often takes convicing the maintainers first and subsequently yonx before it is fixed. I'm speaking from multiple experiences here. For example, the fast image resize crate[3] addressed the resp. issue I filed last Dec.[4] less than a week ago. From the crate being released in the wild to it adding an option to treat color correct almost 1.5 years passed. This is not the same as forcing crate users to treat color correct btw. The crate added a function that calls a closure but a user who do not understand color science may not grok why this is needed and not use it. I guess I'm saying there is also often an 'UX' issue that perpetuates the…
ajenner · 2022-08-10
There's a difference between linear interpolation of sRGB values (what you're doing on your page) and linear interpolation of linear RGB values (which gives better results). This is the explanation that made it all fall into place for me: http://www.ericbrasseur.org/gamma.html?i=1 . The linear RGB colour space is also a linear transformation of the CIELAB space so doing the interpolation in this space is equivalent to transforming to CIELAB space, doing the interpolation there, and then transforming back. However, for the purposes of Area 5150 I think the differences between sRGB interpolation and linear RGB interpolation would have been too subtle to notice since there are only 6 * 16 * 16 = 1536 dithered colour/pattern combinations to choose from in the first place - the error introduced by that quantisation is likely larger than the sRGB vs. linear RGB difference. But I used linear RGB anyway, just to be correct about it.
lstamour · 2019-01-04
I first saw this post in 2009 or so, and it was eye-opening. I found it while googling for why colours shifted when I resized images, as back then there wasn't much awareness of this issue. But it's much less prevalent now. Related -- scaling algorithms: https://en.wikipedia.org/wiki/Image_scaling#Algorithms You don't often find browsers disagreeing in 2019 on how to render things, but image colour -- even on the same MacOS (retina) platform -- appear to be one of those things they disagree on still: https://content.screencast.com/users/LouisStAmour/folders/Snagit/media… Safari on the left, Firefox in the middle and Chrome on the right. So you can try it for yourself, the test page is at http://www.ericbrasseur.org/gamma_dalai_lama.html If this isn't esoteric enough, I know of at least one major broadcast media company (Bell's crave.ca) that doesn't properly encode their HDTV 720p videos in MP4 to flag to the browser they're in Rec 709 colour space, and so the compression artifacts, designed to be invisible in Rec 709 are extremely visible on a wide gamut P3 display. Of course, these flags were only recently respected on all platforms. Chrome on Windows as of Oct 2016: https://bugs.chromium.org/p/chromium/issues/detail?id=655417#c18 and Firefox (err, actually still not fixed, it depends on the codec...) https://bugzilla.mozilla.org/show_bug.cgi?id=1300170#c87 But colour space is increasingly something you have…

Keyboard shortcuts

/Search
j kNext / previous blog
EnterOpen selected blog
vVisit the blog site
fFollow / unfollow
lSwitch grid / list view
dSwitch dark mode
g hHome
g pTop posts
g tTopics
g fFollowing
g lLiked
g yHistory
g qFAQ
EscBack / close