E
Eric Brasseur
4p8.com · Personal blog · on HN since 2008
Eric Brasseur writes about image processing errors, especially how most software mishandles gamma when scaling and blending images.
What HN saysHN commenters link his gamma articles as examples of widespread software errors, and use them to argue for correct image downscaling and color spaces.
30HN people shared it
25linked it in comments
7stories submitted
349story points
10 years agolast shared
2008people per year2026
Most-shared posts
- 1All image-editing software gets scaling wrong21 people · 346 points · first shared 2008 · 52 comments on HN
- 2Gamma dalai lama3 people · first shared 2010
- 3Gamma 1.0 or 2.2.png2 people · first shared 2015
- 4Cppcen2 people · first shared 2012
- 5Lew - a graphics programming language along the veins of Processing based on Lua1 people · 2 points · first shared 2008 · 1 comments on HN
- 6Eric Brasseur's Articles1 people · 1 points · first shared 2010 · discussion on HN
- 7Gamma.html>1 people · first shared 2015
- 8Gamma1 people · first shared 2013
- 9Gallery1 people · first shared 2008
- 10Gamma dalai lama gray.jpg1 people · first shared 2009
What HN people wrote when they linked it
ansgri · 2016-09-21
Enough has been said about incorrect gamma (this and [0]), now I think it's high time to bash the software of the world for incorrect downscaling (e.g. [1]). It has much more visible effects, and has real consequences for computer vision algorithms.
In the course on computer vision in my university (which I help teaching) we teach this stuff to make students understand physics, but at the end of the lecture I'd always note that for vision it's largely irrelevant and isn't worth the cycles to convert image to the linear scale.
[0] http://www.4p8.com/eric.brasseur/gamma.html
[1] http://photo.stackexchange.com/questions/53820/why-do-photos-of-digita…
leni536 · 2016-03-11
I know that this is an introduction, but I wish there was a warning about the use of improper color spaces for different tasks (like using sRGB or any nonlinear colorspace for downscaling images, blurring or Phong shading). A warning about the existence of different colorspaces and their different use cases would be enough in an introductionary write up. It's still an issue in most of today's software [1].
Like open this image in your browser or in your favorite image viewer and scale it down to 50%:
http://www.4p8.com/eric.brasseur/gamma-1.0-or-2.2.png
[1] http://www.4p8.com/eric.brasseur/gamma.html
nkron · 2015-12-02
Another great article highlighting how often software gets it wrong is here: http://www.4p8.com/eric.brasseur/gamma.html
colanderman · 2015-11-06
Surprising that HN includes the angle bracket as part of the link... I'm pretty sure using angle brackets like that to delineate a link is recommended in some major RFC...
Fixed link here, thanks: http://www.4p8.com/eric.brasseur/gamma.html
Natsu · 2011-01-11
I use and love it, but I sincerely wish they'd change the name and the UI. I'm a programmer, but even I didn't realize how much they were hiding in context menus at first until I had to search online to find documentation on how to do the few simple things I can do.
The multi-window thing I really don't have much of a problem with, though, even if it was hard to get used to at first. I don't have much use for the higher bit depths and such, but I can see his point about quality and why others need it.
Incidentally, a lot of programs have problems with gamma. I think this link has been on HN a few times: http://www.4p8.com/eric.brasseur/gamma.html
jacobolus · 2015-12-02
A tricky thing w/r/t browsers is that they are often really crappy at figuring out what color space a PNG image is supposed to be in. I think they often intentionally strip out the color space info from PNG images for the sake of helping PNG images blend smoothly into CSS / Flash / etc., for which they also don’t do correct color management. [The CSS spec says that colors should be interpreted as sRGB, but browsers don’t actually follow the spec.]
As a result of this problem, it’s difficult to judge whether image resizing specifically is being done incorrectly, or whether the image is just being interpreted incorrectly at any size.
You’ll notice if you open your first test image (http://www.4p8.com/eric.brasseur/gamma-1.0-or-2.2.png) in Apple’s Preview app, you get the correct behavior, but this is different from the behavior in Safari, for example, which shows something incorrect at every size. Stranger still, the behavior in Safari is roughly “correct” while resizing a browser window, but as soon as you let go of the mouse, it reverts to being incorrect.
There are multiple possible ways to embed color space info into PNG images, and the PNG spec is actually really terrible and confusing on this subject which results in lots of inconsistencies from one implementation to another. If I remember correctly some of them are treated better by browsers than others, but I’m not sure if there’s a way to encode images such that it will be handled properly everywhere (I mean,…
ploxiln · 2016-09-21
Nope, world doesn't end, but scaled images look wrong, some more than others. For more examples see http://www.4p8.com/eric.brasseur/gamma.html
vanderZwan · 2016-07-02
> If the images have obvious rectangular borders (due to the color specified in the bKGD chunk), the browser is broken.
Well, Chrome is still broken for some of these images on Linux. Not surprising though, it also screws up resizing images:
http://www.4p8.com/eric.brasseur/gamma.html
I with they would fix these things before worrying about wide gamut
Retr0spectrum · 2015-03-21
One small issue is that it doesn't correct for gamma. Most browsers don't even do it properly, so it isn't a very important issue at all.
Demo: http://firesize.com/100x100/g_center/http://www.4p8.com/eric.brasseur/…
More info: http://www.4p8.com/eric.brasseur/gamma.html
pyalot2 · 2013-11-18
If you care about color, you should not miss "The importance of being linear" http://http.developer.nvidia.com/GPUGems3/gpugems3_ch24.html and corresponding discussion on wrong gamma in a variety of programs http://www.4p8.com/eric.brasseur/gamma.html
The prettiest gradients won't look good if the output color doesn't match the displays gamma.
DougBTX · 2013-10-09
Fixed url, needs the html extension: http://www.4p8.com/eric.brasseur/gamma.html
Wenbo_Yang · 2013-10-09
I read this Eric's article "Gamma error in picture scaling" 6 years ago. Sadly, FireFox still sucks... http://www.4p8.com/eric.brasseur/gamma.htm
ivank · 2013-07-06
Part of the reason rescaled images look dim and blurry is because rescaling software usually assumes gamma 1.0 instead of 2.2: http://www.4p8.com/eric.brasseur/gamma.html
There are many more good essays on image rescaling here: http://entropymine.com/imageworsener/
corysama · 2013-04-07
Hmm... I'm quite familiar with gamma correction. For those who are not, I recently did an "Explain Like I'm Five" http://www.reddit.com/r/explainlikeimfive/comments/1aeuyb/eli5_linear_…
But, my understanding is that for an image displayed 1-1 pixel-to-screen there is no intermediate math going on. So, there shouldn't be any opportunity for non-gamma-correct calculations to screw up the output.
Here's a nice example of non-gamma-correct browsers producing incorrect results after scaling an image: http://filmicgames.com/archives/354 also http://www.4p8.com/eric.brasseur/gamma.html But, in the SO question there is no scaling. So, I'm still confused about the difference in visual results between different applications directly displaying the image...
lumberjack · 2012-11-13
http://cplusplus.com/doc/tutorial/
http://www.horstmann.com/ccj2/ccjapp3.html
http://www.4p8.com/eric.brasseur/cppcen.html
I was in a similar situation just lately. The above are some very good introductory stuff I found very useful.
gosub · 2012-05-26
I would start with "learn c the hard way" and when she is confortable, go for c++. c++ has some idiosyncrasies as a high level language that are better understood from a c point of view.
As a casual c programmer, I've found this "c to c++" tutorial very useful:
http://www.4p8.com/eric.brasseur/cppcen.html
It now appears to be offline, so here is the cached version:
http://webcache.googleusercontent.com/search?q=cache:http://www.4p8.co…
socksy · 2011-07-26
You may be interested in this article that was on hacker news a while ago: http://www.4p8.com/eric.brasseur/gamma.html
And the hacker news discussion: http://news.ycombinator.com/item?id=1523991
AndrewHampton · 2010-07-18
Interesting that Google's Chrome 5.0 doesn't display the browser examples correctly, but the browser on my Android phone does.
Link to examples: http://www.4p8.com/eric.brasseur/gamma_dalai_lama.html
barrkel · 2010-07-18
127,127,127 feels dark. The explanation is in the article:
http://www.4p8.com/eric.brasseur/gamma.html#explanation
Basically, if you have a test image which consists of alternating black and white, it should have the same perceived brightness when you scale it down - but when you scale it down, the software needs to average out the black and white. If it does a simple arithmetic average, it'll probably choose 127,127,127 once it's downscaled enough to become uniform in color. But if you compare that uniform color with the original black and white lines, it looks a different shade - a darker shade. That's because 127,127,127 isn't 50% grey, it's not in the middle between black and white.
The article has further explanation.
hackermom · 2010-07-17
Safari 5.0 on OS X gets it wrong (http://www.4p8.com/eric.brasseur/gamma_dalai_lama.html); just a gray image with subtle, barely visible pink and green contours.
mbrubeck · 2010-03-09
It's not that complex, but it's complex enough that even Adobe Photoshop gets it partly wrong:
http://www.4p8.com/eric.brasseur/gamma.html
http://news.ycombinator.com/item?id=1141971
wendroid · 2010-02-27
Here's something you might find interesting
Gamma error in picture scaling
http://www.4p8.com/eric.brasseur/gamma.html
jmillikin · 2010-02-22
Although the article is dated 2007, the error it describes is still present in every implementation I've tested. There's a test page for browsers at:
http://www.4p8.com/eric.brasseur/gamma_dalai_lama.html
keenerd · 2009-09-24
Oh. It dropped my original comment.
This is a little something I whipped up last night. Wrapping it for the web took longer than the actual algo. Anyway, the algo is the questionable part. I think most glitches are fixed. For example http://www.4p8.com/eric.brasseur/gamma_dalai_lama_gray.jpg comes out properly.
Thanks for giving it a whirl!
iamwil · 2008-03-27
Gallery here:
http://www.4p8.com/lew/gallery.html