Slashdot Mirror


Scaling Algorithm Bug In Gimp, Photoshop, Others

Wescotte writes "There is an important error in most photography scaling algorithms. All software tested has the problem: The Gimp, Adobe Photoshop, CinePaint, Nip2, ImageMagick, GQview, Eye of Gnome, Paint, and Krita. The problem exists across three different operating systems: Linux, Mac OS X, and Windows. (These exceptions have subsequently been reported — this software does not suffer from the problem: the Netpbm toolkit for graphic manipulations, the developing GEGL toolkit, 32-bit encoded images in Photoshop CS3, the latest version of Image Analyzer, the image exporters in Aperture 1.5.6, the latest version of Rendera, Adobe Lightroom 1.4.1, Pixelmator for Mac OS X, Paint Shop Pro X2, and the Preview app in Mac OS X starting from version 10.6.) Photographs scaled with the affected software are degraded, because of incorrect algorithmic accounting for monitor gamma. The degradation is often faint, but probably most pictures contain at least an array where the degradation is clearly visible. I believe this has happened since the first versions of these programs, maybe 20 years ago."

368 comments

  1. Oh calm down.. by Anonymous Coward · · Score: 4, Insightful

    Photographs scaled with the affected software are degraded, because of incorrect algorithmic accounting for monitor gamma.

    Seriously!

    I have a theory on why this has gone unnoticed for so long, but I'll keep it to myself...

    1. Re:Oh calm down.. by biryokumaru · · Score: 1

      I think it's because of his atrocious grammatical errors!

      On this sheet of paper, the black laser printer ink dots bleeded in all directions.

      --
      When you're afraid to download music illegally in your own home, then the terrorists have won!
    2. Re:Oh calm down.. by Anonymous Coward · · Score: 2, Informative

      Yes because everyone in the world who posts to the internet is a native English speaker.

      Having read that I am willing to be English isn't his first language

    3. Re:Oh calm down.. by nollidge · · Score: 3, Funny

      Having read that I am willing to be English isn't his first language

      I am willing to be Mavis Beacon.

    4. Re:Oh calm down.. by SEWilco · · Score: 1

      I have an explanation, but it will not fit in this margin.

    5. Re:Oh calm down.. by Anonymous Coward · · Score: 1, Insightful

      oh you think this was never noticed? :P

      the entire graphic community (as in printing companies, layouters, ...) knows about this for years.

      errrrrr make that... SHOULD have known about this for years...

    6. Re:Oh calm down.. by imakemusic · · Score: 5, Funny

      He seems to take it seriously.

      Probably a gamma nazi...

      --
      Brain surgery - it's not rocket science!
    7. Re:Oh calm down.. by Anonymous Coward · · Score: 0

      Ha ha ha!

    8. Re:Oh calm down.. by Anonymous Coward · · Score: 0

      I have a theory about why this has not been flagged previously, too, but there isn't room in this narrow box to explain it.

    9. Re:Oh calm down.. by Anonymous Coward · · Score: 0

      Funny thing is, I noticed this when scaling an image in Photoshop CS4 yesterday for the first time -- and it was quite noticeable. Scattered pixels in an RGB image scaled to an incredibly wrong shade. This compounds with each repeated scaling. I think I've noticed this in the past as well, but never put my finger on what was wrong then.

  2. Monitor gamma? by Yvan256 · · Score: 2, Insightful

    To display the pictures, it makes sense to use the monitor gamma. But to actually modify the data using that information which is probably flawed in 99.9999999% of cases? That's just wrong.

    1. Re:Monitor gamma? by Trepidity · · Score: 2, Interesting

      In some cases at least it seems like the primary purpose of scaling is to display the images immediately, in which case it seems like the gamma should be accounted for. For example, when browsers rescale images, it's an unexpected result if they change the perceived brightness while doing so--- shouldn't the browser's scaling be done in the same brightness space as the one it intends to use to display the images?

    2. Re:Monitor gamma? by theskipper · · Score: 5, Funny

      Excellent point. Just to be safe though, I'm going to take another look through my porn crypt to see if that's true.

      BRB.

    3. Re:Monitor gamma? by poetmatt · · Score: 3, Interesting

      The responses that they post are also inaccurate it seems.

      From

      All four images in this page are the same one but your browser was instructed to scale it. The one below is scaled 1:2. On Opera and some versions of Internet Explorer it will show a gray rectangle.

      meanwhile, I see a grey rectangle in firefox, and I still don't get what that signifies.

    4. Re:Monitor gamma? by evanbd · · Score: 5, Informative

      The data in the pictures is not linear data. It assumes that it will be displayed on a system that introduces a gamma of 2.2. (If your display system does not do that physically, it should correct for this.) That is, a gray 127 should not display as halfway between a white 255 and a black zero, in terms of light output. (It should *appear* halfway between them visually, because your eyes aren't linear — that's (part of) why gamma is in use in the first place.) So, a checkerboard pattern of white / black squares will have half the luminosity of the white squares. When scaling down, software will turn it into a bunch of gray pixels. But they should be gray pixels of value 186, not 127.

      The page is not well written, but his example images make the issue very clear. It's not about your monitor gamma; it's about the "standard gamma" that all image files assume your monitor has.

    5. Re:Monitor gamma? by zippthorne · · Score: 1

      But the file formats don't specify this. The image from a camera will set gray 127 to pretty much half the number of photons hitting the sensor as white 255, won't it?

      --
      Can you be Even More Awesome?!
    6. Re:Monitor gamma? by tagno25 · · Score: 1

      The responses that they post are also inaccurate it seems.

      From

      All four images in this page are the same one but your browser was instructed to scale it. The one below is scaled 1:2. On Opera and some versions of Internet Explorer it will show a gray rectangle.

      meanwhile, I see a grey rectangle in firefox, and I still don't get what that signifies.

      The first one I have a hard time seeing it, but I can.
      For the others have to scale the page to max to see anything other than a gray rectangle (using chrome)

    7. Re:Monitor gamma? by Anonymous Coward · · Score: 0

      If your camera produces "raw" image files, that may be the case. If it produces JPEG files, it is almost certainly applying a gamma correction of some kind. Otherwise the images would look very wrong when displayed on a normal computer screen.

    8. Re:Monitor gamma? by evanbd · · Score: 5, Informative

      Actually, any well-specified file format will specify the gamma. Not all allow you to set it per-file, but they do specify it. Normally this is a line in the spec that reads something like "color values use the sRGB color space" or similar — which specifies a gamma of 2.2 (roughly). And sRGB with it's nearly 2.2 gamma has become so standard that assuming anything else (in the absence of a clear spec) would be idiotic.

    9. Re:Monitor gamma? by reub2000 · · Score: 2, Informative

      Depends. Standard sRGB used in a jpeg file stores the data in non-linear format. If data was stored in a linear format, then a disproportionate part of the gamut would be in the highlights. On the other hand, a raw file contains the data in a linear format.

    10. Re:Monitor gamma? by Anonymous Coward · · Score: 0

      For me in FF I get a grey box for the first scaled image and the two smaller ones below show the scaled image shaded (top/middle/bottom) green/grey/red and red/grey/green.

      For both IE and Chrome I see the first scaled image as appearing very lightly embossed. Both of the smaller scaled images also appear very faintly embossed, not quite a perfectly even grey.

    11. Re:Monitor gamma? by X0563511 · · Score: 1

      Yes, excepting that this issue is talking about the bug in image editors.

      --
      For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
    12. Re:Monitor gamma? by X0563511 · · Score: 2, Insightful

      Here:
      http://img43.imageshack.us/img43/2586/scalerbug.png

      Look at the third set of images. Had this bug not been present, they should have been nearly identical. As you can see, in my case, they are radically different.

      As the text reads:

      (dali picture)
      All four images in this page are the same one but your browser was instructed to scale it. The one below is scaled 1:2. On Opera and some versions of Internet Explorer it will show a gray rectangle. KDE Konqueror, Firefox and SeaMonkey will display it either pink or green or half-green, half-pink:

      (smaller dali or grey box)
      (mine draws in grey, despite using Firefox)

      Below it is scaled down 1:4. The right one is one pixel wider and higher than the left one. Some browsers display them quite differently:

      (two images, differing if you have the bug)

      --
      For large sets, this will be our guide even unto death, for the LORD will work for each type of data it is applied to...
    13. Re:Monitor gamma? by DocHoncho · · Score: 2, Insightful

      meanwhile, I see a grey rectangle in firefox, and I still don't get what that signifies.

      It means the scaling algorithm in your web browser and other commercial softwares is disastrously broken. Duh, didn't you RTFA?

      --
      Celebrity worship is a poor substitute for Deity worship and costs more to boot.
    14. Re:Monitor gamma? by Anonymous Coward · · Score: 5, Funny

      Well?

    15. Re:Monitor gamma? by spitzak · · Score: 1

      Linear data needs a lot more than 8 bits to work correctly. Most "raw" formats use 12 or more.

      So I would think anything storing white as 255 is going to use a gamma curve and 127 is not 1/2 white but some darker value.

    16. Re:Monitor gamma? by Idarubicin · · Score: 1

      Yes, excepting that this issue is talking about the bug in image editors.

      Keep reading the article; this problem exists in web browsers as well.

      --
      ~Idarubicin
    17. Re:Monitor gamma? by shutdown+-p+now · · Score: 1

      But the file formats don't specify this. The image from a camera will set gray 127 to pretty much half the number of photons hitting the sensor as white 255, won't it?

      If I understood TFA correctly, the problem is that it won't.

    18. Re:Monitor gamma? by Idarubicin · · Score: 5, Informative

      It seems crazy to me to embed a particular Gamma value into an image. ...In fact it seems so crazy I must be missing something. Am I?

      The article actually touches on this point. The sensitivity of the human eye isn't linear. If you use a linear scale to store luminosity information for an image, you waste a lot of bit depth at high luminosities - the eye has difficulty distinguishing between very bright and very bright plus a little tiny bit. On the other hand, the eye is very good at telling the difference between very dark and black. You need a lot of finely-graduated steps at low luminosity or else your shadows get jaggy.

      If you uniformly (linearly) space out luminosities on an 8-bit (256-shade) scale, you store a lot of uninteresting information at the high end, and lose out on visible detail at the low end. A scale with gamma of 2.2 (typical these days) fits a full twenty-eight grey values between 0 and 1 on our hypothetical linear scale. To maintain that kind of luminosity resolution (down where it matters), you'd have to store an extra five bits on your linear scale. An extra sixty percent costs.

      --
      ~Idarubicin
    19. Re:Monitor gamma? by DeathElk · · Score: 5, Funny

      Well?

      Somehow I don't think you've given him enough time.

    20. Re:Monitor gamma? by Anonymous Coward · · Score: 2, Informative

      Yes, you are missing something. Human perception isn't linear either. Twice the amount of light does not look twice as bright. Our eyes see differences between dark tones more clearly. The result is that we need many more dark tones than light tones for an "evenly" distributed tone curve (which is a tone curve where two neighboring light tones appear to be the same brightness difference as two neighboring dark colors). A physically linear gradient has the perceptual half tone shifted close to the black point.

      One consequence is that if you store an image with linear gamma, you need more bits to cover the same dynamic range with the same minimal distance between two dark tones. You can immediately see the decrease in resolution for the dark tones when you create an 8-bit image with a black-white gradient in Photoshop and then convert this image to a color profile with gamma 1.0.

      So not only is the 2.2 gamma which is used in the sRGB standard a sensible choice for the display technology of yesteryear, it also makes better use of the allocated bits than a gamma 1.0 image would.

    21. Re:Monitor gamma? by Zaphod+The+42nd · · Score: 1

      You didn't because the article has nothing to do with cameras and this guy was making a postulation.

      This article is about, given an image, software scales it down incorrectly. Now, I am not a photographer, but I would assume that the proper image taken by a camera ends up in a computer file exactly the way it was taken. And has nothing to do with this bug. Though, the image taken by that camera, if downsized, may have it...

      --
      GCS/MU/P d- s:- a-- C++++$ UL++ P+ L++ E+ W++ N o K- w--- O M+ V- PS+++ PE Y+ PGP t+ 5- X R++ tv+ b++ DI++ D++ G+ e++ h-
    22. Re:Monitor gamma? by prod-you · · Score: 1

      I have ImageZoom, and zooming in on the pictures shows that they're actually the same image.

    23. Re:Monitor gamma? by iknowcss · · Score: 2, Insightful

      That or you gave him too much time, he got bored with the idea, and forgot about it. You didn't wait more than 4 minutes, did you?

      --
      Life is rarely fair. Cherish the moments when there is a right answer.
    24. Re:Monitor gamma? by compro01 · · Score: 1

      That definitely makes it clear, thanks. I see no difference on the 2nd or 3rd, but the first one of the Dali Lama is radically different when scaled vs. unscaled.

      Using Firefox 3.6 on Windows 7.

      --
      upon the advice of my lawyer, i have no sig at this time
    25. Re:Monitor gamma? by shutdown+-p+now · · Score: 1

      Er... I merely answered GP, who asked if "half the photons" of white would make #7F7F7F (assuming "all photons" would make #FFFFFF). My answer does not in any way imply that picture of the camera is somehow "incorrect".

      And of course the picture ends up in a file exactly as taken. We're talking about the moment where it's taken - when analog output of light sensors is converted to digital pixel values.

    26. Re:Monitor gamma? by eelke_klein · · Score: 1

      Actually it is good to use a particular gamma for storing an image because the human eye is not linear. If a gamma of 1 was used to steps at the black end would be to large and at the white end to small (when using 8-bits per channel).

      We are not using a gamma of 2.2 because the old CRT's did the CRT's had a gamma of 2.2 because it was determined that would work well.

    27. Re:Monitor gamma? by socsoc · · Score: 1

      Is this new? The meta tag for the date attribute on that page says 20080203

    28. Re:Monitor gamma? by Anonymous Coward · · Score: 1, Funny

      I don't think you want the results he has to present...

    29. Re:Monitor gamma? by Mr+Z · · Score: 1

      Are you sure about that? I think you're right, but it's confusing. Supposedly, JFIF files are intended to have a gamma of 1.0. (JFIF stands for JPEG File Interchange Format and is the official name for what's inside a .JPG file.) Anyway, quoting from the JFIF spec:

      A number of color spaces can be used: grayscale, RGB and CMYK are all common in prepress. For internet use, the color space can also be YCbCr as defined by CAIRN 601 (256 levels). The RGB components calculated by linear conversion from YCbCr shall not be gamma corrected (gamma = 1.0).

      Now, that's the sound bite that suggests JFIF actually deals with linear light. But, if you carefully read the actual JFIF 1.02 spec and compare it to other resources, what sounds like "linear light" really isn't, and JPEGs really do encode "display-ready" pixels that are gamma corrected.

      In the JFIF spec, it says:

      The color space to be used is YCbCr as defined by CCIR 601 (256 levels). The RGB components calculated by linear conversion from YCbCr shall not be gamma corrected (gamma = 1.0). If only one component is used, that component shall be Y.

      So far, it jibes with that first resource. A little later, on page 4, the JFIF spec gives a series of transformation functions between YCbCr and RGB. Mark your page, and flip with me to compare this to the referenced CCIR 601. Wikipedia has a nice summary here, assuming you don't want to send off to the ITU in Geneva for a copy of CCIR 601.

      The matrix that JFIF defines matches the non-scaling YPbPr matrix in the Wikipedia page. That makes sense: Rather than use the narrower [16, 235] range that CCIR 601 specifies for component video, JFIF does state that Y, Cb and Cr "are normalized so as to occupy the full 256 levels of an 8-bit binary encoding." And if you scroll down on the Wikipedia page, you'll see that they have the same matrix with JPEG-specific scale factors applied that match the JFIF spec.

      But here's the kicker. Notice that the CCIR matrix uses R', G' and B'. The prime symbol means that the signal is not linear light! That is, the signal is gamma corrected and is intended to be displayed on a device with the corresponding gamma as-is with no further correction.

      This interpretation is bolstered by Charles Poynton's Color FAQ which states plainly: "The prime symbols in this equation, and in those to follow, denote nonlinear components," and later states "Use prime symbols ( ' ) to denote all of your nonlinear components!" Interestingly, Poynton also notes "no practical image coding system employs linear colour differences."

      So what does that really mean? It means that while the JFIF spec says "gamma = 1.0," what they really seem to have meant (and, what everyone seems to have done) is take data intended for direct display without further correction, and then encode it. The result is that no gamma correction needs to be applied to a decoded JFIF file before display, because it's already in display gamma.

      At least, I think. But if you just skim the JFIF spec, you'd come away thinking it dealt with linear light.

    30. Re:Monitor gamma? by MechaStreisand · · Score: 1

      The scaling algorithm in browsers has never worked right. Until very recently, they all did nearest neighbor scaling. I don't expect anything remotely accurate from web browser image scaling and I'm surprised that anyone ever would.

      --
      Disclaimer: IANAL. This post is, however, legal advice, and creates an attorney-client relationship.
    31. Re:Monitor gamma? by omfgnosis · · Score: 1

      I don't think any current-version browser besides IE has used nearest neighbor scaling for years, and i can't say for sure but I don't think any release version of Safari or Firefox ever did.

    32. Re:Monitor gamma? by rvw · · Score: 4, Informative

      meanwhile, I see a grey rectangle in firefox, and I still don't get what that signifies.

      Right-click the image, then click view image. You'll see the image full-scale, like the first image. Scaling it down 50% shouldn't make it gray.

    33. Re:Monitor gamma? by Anonymous Coward · · Score: 0

      Just turn off the color management thingy.

    34. Re:Monitor gamma? by Anonymous Coward · · Score: 1

      ok. who had this great idea of hardcoding the gamma within the data itself?

    35. Re:Monitor gamma? by MechaStreisand · · Score: 1

      I've used Firefox for a long time, since it was Phoenix, in fact, and it seems that until not long ago, whenever it scaled an image down it was horribly aliased. I'm on 3.5.8 now and its scaling seems to be improved (maybe it's bilinear now - not great), but I am quite sure that fairly recently it was nearest neighbor, either in the 3.0 branch or 2.0. As far as Safari goes, I have no idea.

      --
      Disclaimer: IANAL. This post is, however, legal advice, and creates an attorney-client relationship.
    36. Re:Monitor gamma? by OrangeCatholic · · Score: 1

      >To display the pictures, it makes sense to use the monitor gamma. But to actually modify the data using that information which is probably flawed in 99.9999999% of cases? That's just wrong.

      You should read his explanation. It's pretty lucid. It has to do with the fact that the gamma is expected and built into the system. It's also largely standardized at 2.2. So to ignore the gamma is a fundamental mistake.

      The purpose of the gamma is to allow fine gradients of very dark and very white. Without it, 8-bit color is basically useless....you would have black, lots of grey, and then white. No off-whites or decent shadows.

    37. Re:Monitor gamma? by nagnamer · · Score: 1

      Yes, excepting that this issue is talking about the bug in image editors.

      Keep reading the article; this problem exists in web browsers as well.

      GGP is talking about image editors. It's not even a "problem" in web browsers.

      --
      Every harsh word you utter has the right address. It only sounds harsh because the one on the envelope is the wrong one.
    38. Re:Monitor gamma? by Shin-LaC · · Score: 1

      The gamma is just the exponent in the function Vout = Vin**gamma. You can apply this function repeatedly to convert between different representations or to adapt the image to different output devices. The "gamma = 1.0" in the JFIF spec does indeed refer to the conversion applied to the RGB values obtained from YCbCr before sending them to the screen: it says that this conversion is the identity function, ie no conversion, ie the RGB as obtained by linear transformation of the YCbCr is already fit for display on a monitor - ie it is already at gamma 2.2.

    39. Re:Monitor gamma? by N+Monkey · · Score: 1

      But the file formats don't specify this. The image from a camera will set gray 127 to pretty much half the number of photons hitting the sensor as white 255, won't it?

      No. Your camera will (probably) assume sRGB for 8bit/channel data in which case halfway between black and white will be about 186 (don't have time to get the correct value), not 128.

      The human visual system is non-linear - in dark areas it can distinguish finer changes in brightness than in brighter areas - and so to get the best "bang-for-the-bit", the encoding used by display systems is also non-linear. For more information see Poynton's Gamma FAQ.

    40. Re:Monitor gamma? by Anonymous Coward · · Score: 0

      Yay for you. I have a mouse wheel and a ctl key.

    41. Re:Monitor gamma? by tristes_tigres · · Score: 1

      His hands must be full right now

    42. Re:Monitor gamma? by Twinbee · · Score: 1

      Rather than have the image specification pandering to the whims of the hardware's arbitrary gamma, all monitor manufacturers should get together and make a standard, and keep to it.

      Then "linear" will be linear forever, at least in software space.

      --
      Why OpalCalc is the best Windows calc
    43. Re:Monitor gamma? by orasio · · Score: 1

      (dali picture)

      If it were actually a Dali picture, he would have intended it to show this way.

    44. Re:Monitor gamma? by Hognoxious · · Score: 1

      S Rly?

      --
      Confucius say, "Find worm in apple - bad. Find half a worm - worse."
    45. Re:Monitor gamma? by grumbel · · Score: 1

      Firefox 3.5.8 on Ubuntu 9.10 still does that and it and it makes zooming pretty much unusable.

    46. Re:Monitor gamma? by DarkOx · · Score: 1

      Either that or be contented with the mere fact it exists and is connected in some way with all the rest of the digital world, no matter how it is displayed.

      --
      Repeal the 17th Amendment TODAY! Also Please Read http://www.gnu.org/philosophy/right-to-read.html
    47. Re:Monitor gamma? by danieltdp · · Score: 1

      I guess we are talking about zoom resize, not actual image resize. When you zoom in and out of the image, there is a rescale going on in memory. This rescale should take gamma into account, because is only for visual purposes.

      People that uses photoshop usually checks the image out on true size from now and then, just to make sure they get the picture (pun intended).

      --
      -- dnl
    48. Re:Monitor gamma? by evanbd · · Score: 2, Informative

      They did exactly that. It's called sRGB, and these days (nearly) all monitors claim to follow it. Some have better color than others, but they're all nominally sRGB. The ones that don't follow sRGB are well-specified as doing something else (and expensive), and purchased by people that know what to do with them. The (somewhat) arbitrary standard is a gamma of roughly 2.2. Monitors that don't produce that naturally fake it with software (in the monitor, not the computer).

      The problem is that the computer software doesn't expect linear, when it comes to what color is what, because it never has been linear. Basically, 256 shades of brightness is enough — but only if they aren't linearly spaced. There's a huge difference between a gray that's 1% of the white luminosity and 0%, but you can't see the difference between 99% and 100%. Using a gamma curve fixes this, by roughly matching the apparent change in brightness per change in the brightness. So the whole toolchain is built around a gamma of roughly 2.2, except when it comes to things like image manipulation.

    49. Re:Monitor gamma? by jonadab · · Score: 1

      > meanwhile, I see a grey rectangle in firefox,
      > and I still don't get what that signifies.

      It mostly signifies that the image in question was carefully designed to be pathologically horrible.

      In fact, it's not really one image, but two very different images, interleaved every-other-line. Look closely (or, if your eyes are bad, zoom to 400% or so). The one image is tinted heavily toward green, and the other heavily toward magenta, and the brightness and contrast of each of them are heavily distorted, in a way that causes the average across two lines to always be the same shade of gray. The green image is brighter in the bright areas and darker in the dark areas; the magenta image is not as bright in the bright areas and not as dark in the dark areas. Additionally, the green image uses extra red in the dark areas to compensate for the darkness of the magenta image. And that's just the obvious stuff.

      Frankly, the fact that you see the Dalai Llama (when it's not scaled down) if you back up and view it from a distance is *arguably* an optical illusion, or at the very least a testament to the amazing design of your visual cortex, that it's able to make any kind of sense at all out of the distorted mess your eyes are giving it. Designing software to do the same thing when scaling the image down is probably beyond the reach of the current state of the art in computer science, or certainly it would have to draw heavily on AI vision research. Straightforward arithmetic isn't going to produce anything that looks like the Dalai Llama if it takes the whole image into account.

      What you *can* do, to work around the interleaved design of the image, is use the most naive scaling algorithm of all, wherein the software just takes every other pixel and ignores the ones in between. That will give you either the green or the magenta version of the image, depending on whether your software takes the first pixel or the second pixel of every pair. The fact that this gives better results than VASTLY superior algorithms is a testament to the pathologically extreme design of the image.

      --
      Cut that out, or I will ship you to Norilsk in a box.
    50. Re:Monitor gamma? by jonadab · · Score: 1

      IMO, what it actually means is that the so-called image is deliberately designed to be as catastrophically horrible as possible when scaled down. (Actually, it's two images, interleaved line-by-line, both of them horrible in a wide variety of ways.) A flat gray rectangle is arguably the *correct* result. If you get a magenta or green version of the image, your browser is using a very naive scaling algorithm that ignores half of the information in the image. I do not see any reasonable way to construct an algorithm that would reproduce at a smaller scale the same optical illusion contained in the original, since the illusion relies heavily on the precise pixel-by-pixel construction of the image.

      --
      Cut that out, or I will ship you to Norilsk in a box.
    51. Re:Monitor gamma? by grumbel · · Score: 3, Informative

      IMO, what it actually means is that the so-called image is deliberately designed to be as catastrophically horrible as possible when scaled down.

      Yes, the image is designed to exploit the bug in way that makes it very obvious that the scaling is wrong, but no, the gray rectangle is not the correct solution. The problem is that the browser or the image application assumes that the brightness is stored on a linear scale, while in reality its stored exponential one. Thus when you scale things or apply other filters the brightness will be messed up. In real photos it will be less noticeable then here, but it will still happen.

      The correct way would be to transform the image to a linear scale before applying the filter and then restoring it the exponential one for display. A simple example of how to do that in Gimp (using gausian blur instead of scale, but it is the same bug) would be this. The left image is the original from the article, the middle one is blur applied and the right one is applying a gamma of 0.5 to get it to a linear scale, then the blur and then a gamma 2 to restore it to its original scale. As you can easily see the right one looks like the left one, but blurred, while the middle one has no resemblance to the original, all the information got lost due to the bug. In practice you would need a higher bit depth to make this trick practical, as else you would end with banding artifacts.

    52. Re:Monitor gamma? by omnichad · · Score: 1

      the values from 0-255 are intended to be displayed with a gamma correction. They aren't in themselves actually brightness values. This isn't really the *monitor* gamma. It's just the gamma. The formula for converting the stored numerical value to the actual brightness value. The way the eye interprets brightness is logarithmic and this is just how a computer does the same.

    53. Re:Monitor gamma? by omnichad · · Score: 1

      Well - the sensor would be more than 8 bits. Before going down to 8-bit, it then applies a gamma to the value before storing it in the image. Otherwise, we'd have a lousy contrast range.

    54. Re:Monitor gamma? by honestmonkey · · Score: 1

      "have to draw heavily on AI vision research. Straightforward arithmetic isn't going to produce anything that looks like the Dalai Llama"

      I guess I'd have to disagree with you if indeed, as the article claims, there are some programs that actually get this correct. It is a constructed image, sure, but just so that it can point out the bug. The scaling algorithms in most programs don't actually scale, like slipping a magnifying glass over the pic or something. They do math to the image, and they do the math in a way that some images give goofy results. However, there are programs that do this math to an image and return expected results. No AI needed.

      --
      Everything you know is wrong, Just forget the words and sing along.
    55. Re:Monitor gamma? by plate_o_shrimp · · Score: 1

      I guess we are talking about zoom resize, not actual image resize. When you zoom in and out of the image, there is a rescale going on in memory. This rescale should take gamma into account, because is only for visual purposes.

      Using one of his test images I saw the bug manifest in both zoom and scale resize (in Gimp)....

      --
      This sig has exceed its monthly bandwidth allotment.
    56. Re:Monitor gamma? by Mr+Z · · Score: 1

      Right. My point is that I've seen a number of references claim that JPEG is supposed to store "linear light" data due to the statement "gamma = 1.0" in the JFIF spec, when really what JFIF means is that JPEG files deal with display-ready data that's already been gamma corrected.

      Poynton's Gamma FAQ is pretty cool, BTW, and highlights a lot of the issues that arise with trying to discuss gamma, including folks throwing a lot of imprecise language around muddying the waters. His companion Color FAQ shows where a coding format such as JPEG is supposed to fit in item #27, and specifically in this diagram. JPEG provides the equivalent of the four blocks at the right (color-diff encode, subsampling, interpolation, color-diff decode). The input and output of JPEG is already in the non-linear domain.

      That doesn't stop people from getting confused by the "gamma = 1.0" statement in the JFIF spec. For example this page makes the (incorrect) statement "The JFIF file standard (that uses JPEG compression) specifies that the image to be encoded must have a gamma of 1.0 (i.e. a linear image - but not everyone obeys the rules)." There's a lot of confusion out there. It's a mess.

    57. Re:Monitor gamma? by sounds · · Score: 1

      I think you're wrong. The data in the pictures is "supposed" to be linear, but with amateurs creating content on non-compliant systems the reality is that it rarely is.

      Our eyes are certainly non-linear, and so is a CRT, but the whole point of having the gamma curve is so that all processing (math) can be done on linear data. If the data in the picture is not linear, then why bother with gamma conversion at all? Another part of the problem is that different systems have different gamma, from 0.0 to 1.4 to 2.2, and that means you can't assume the image data was properly captured to a linear curve. I think that the biggest culprit here is Windows, which had no color management, and so users just adjusted colors to look right on their CRT, and eventually the web standard became this non-professional workflow.

      In other words, the assumption of 2.2 gamma that you refer to is only valid when the output device has a gamma of 2.2, while another gamma would need to be assumed when a different output device is used. The only constant is that the data should be linear, but we all know that you can't rely on data to follow standards when every grandma has a camera or scanner.

    58. Re:Monitor gamma? by evanbd · · Score: 1

      No, the data is supposed to be non-linear. At least, that's what most file formats specify, and that was the behavior that was common before well-specified file formats were common.

      Historically, the process was to convert the brightness level linearly to an electron gun control voltage in a CRT. That produced a non-linear brightness output on the screen, with a gamma of around 2.2 (details varied). Today, we have well-specified response curves, but we still use non-linear brightness values. The reason is largely that our eyes are more sensitive to the same (absolute) change on dark parts of the screen than bright parts (eg going from 1% to 2% of full brightness is a vastly larger change than from 99% to 100%). The gamma curve produces an output where unit steps in the (non-linear) brightness value produce similar apparent magnitude changes across the whole brightness range.

      The result is that the scale appears linear: gray 127 looks about half as bright as white 255. It isn't, though. It's about 22% as bright. That apparent linearity is probably the cause of much of the confusion.

      The assumption of gamma 2.2 isn't only in the output device. It's also in the underlying data: cameras output photos that assume gamma 2.2, for example. The standards are certainly a mess, but they've gotten much better recently. It used to be that gamma 2.2 was a half-decent guess, and 1.0 (linear data) an awful guess. Today, sRGB is fairly widely accepted, and it has a gamma of approximately 2.2. In other words, it's always been obvious that assuming linear data is wrong, but it hasn't always been obvious what the right assumption is. Today, though, the right assumption is sRGB unless otherwise specified.

    59. Re:Monitor gamma? by sounds · · Score: 1

      After re-reading your comments, I realize that we're actually talking about slightly different things, and neither of us is being specific.

      Professional graphics software is designed to work with data that is linear. This requires professional operators who maintain a carefully calibrated set of input devices and output devices. All image files that come from film or digital sources must be converted to pure linear, and only processed in linear, then converted with the gamma of the output device. In this world, 2.2 is only used when sending linear data to a CRT. A different gamma would be used for printing, but again the assumption is that everything starts with linear data in the files.

      The professional world used to be the end of the story. With the explosion of the web, more non-professionals were creating image content. More importantly, the vast majority of viewers were looking at the web on monitors that were never calibrated, using an operating system (Windows) which did not have professional color management abilities. Unfortunately, the result of this is that the standard practice became to author image files with the gamma of the monitor built in, thus minimizing the errors.

      So, you actually have two standards. Linear data is expected by professional software, and is used by professionals at all stages of their work flow for source images. Non-linear data is used for image files that are intended for web distribution. Thus, we're both right, because there are really two standards.

      The problem is that you cannot expect to grab an image file off the web and be able to scale it in professional imaging software without accounting for the built-in gamma used for web distribution.

      One happy advancement in the industry is that now images can carry around a description of their linear or non-linear status. What should happen in these cases is that image editing software should use the supplied color management tags to convert the image to linear format before any scaling is done. Theoretically, this should solve the problem of not knowing whether the image file is a professional source image (linear) or one intended for web distribution (non-linear).

      I fully understand the science that you're trying to explain, as I developed commercial monitor calibration software for NEXTSTEP, the precursor to Mac OS X. The only place we disagree is whether the file "should" be linear. The answer is that it depends upon whether you're talking about files for editing or files for distribution. As I explained above, the graphics software that is being criticized is not designed to edit files authored for distribution - at least not unless they're tagged properly with their embedded gamma.

    60. Re:Monitor gamma? by danieltdp · · Score: 1

      Then I don't understand the connection between monitor gamma and the resize. Visualization should't have any impact on image resize....

      --
      -- dnl
    61. Re:Monitor gamma? by amorsen · · Score: 1

      Designing software to do the same thing when scaling the image down is probably beyond the reach of the current state of the art in computer science, or certainly it would have to draw heavily on AI vision research.

      Fail. The author of the article designed software to do the scaling correctly. He didn't use AI or anything fancy, he just changed the gamma to 1, scaled, and converted back to 2.2.

      --
      Finally! A year of moderation! Ready for 2019?
    62. Re:Monitor gamma? by suomynonAyletamitlU · · Score: 1

      Incorrect. It SHOULD be gray, which means for the GP, it was working. With all of the gray pixels in the original image, scaling it down makes you lose almost all the detail instantly.

      I just saw the image incorrectly resized and I think I get what he's saying, which is that some of the color data that should be lost (in that example) isn't, presumably because of the gamma error.

      I dunno whether TinyPic is slashdot-proof, but this is a screenshot with what I assume the error is (no points for telling me to find a new image host):
      http://i45.tinypic.com/imuo40.png

      When I viewed the page in Chrome, those thumbs were essentially pure gray rectangles. Considering even on the browser that rendered this (Firefox), the hlaf size was also a gray block, albeit one with a faint outline, these images would have to be errors.

      Makes sense to me.

  3. What about Irfanview and Picasa? by cytoman · · Score: 1

    I'm not a pro photosoftware user so I guess none of what's discussed here really affects me. But still, I'm curious about Irfanview and Picasa, the two programs that I use for my photo needs. Are these affected? How do I detect the effect?

    1. Re:What about Irfanview and Picasa? by gnapster · · Score: 1

      Resize the photo in the linked article to 50% smaller. If you get a grey rectangle instead of something interesting, your software has teh problem. Irfanview 4.25, according to my quick experiments, has the problem when rescaling, but not resizing.

    2. Re:What about Irfanview and Picasa? by tenton · · Score: 1

      I know this is /. and to say "RTFA" is kind of pointless, but, please, RTFA. There's a tweaked sample there for you to try. It will be obvious if you try their sample with whatever graphics program you want to use.

    3. Re:What about Irfanview and Picasa? by Holmwood · · Score: 1

      If you read the fine article, you'll see they give a sample image you can test against your applications. I tested Irfanview (4.25) and it appears to suffer from the problem. Haven't tried Picasa yet; don't have it installed.

    4. Re:What about Irfanview and Picasa? by cytoman · · Score: 3, Informative

      Gray rectangles in Picasa 3 and in Irfanview 4.25 :-(

    5. Re:What about Irfanview and Picasa? by dotancohen · · Score: 2, Informative

      KDE's KolourPaint (MS Paint clone) gets it right! Yay KDE!

      --
      It is dangerous to be right when the government is wrong.
    6. Re:What about Irfanview and Picasa? by AngryNick · · Score: 2, Funny

      Well, I RTFA and I completely understand why this is happening...the so called "sample photo" is covered with annoying little gray lines. No wonder the picture looks bad when you scale it. The dude needs a new camera.

    7. Re:What about Irfanview and Picasa? by Anonymous Coward · · Score: 0

      Irfanview works fine if you are willing to adjust gamma before and after resize.

      1. Adjust gamma to .45
      2. Resize
      3. Adjust gamma to 2.2

      I suspect many other apps will work too if the same steps are performed.

    8. Re:What about Irfanview and Picasa? by HatofPig · · Score: 1

      Hmmm, not for me. Note there are two scaling options, regular and "smooth" scale. http://img148.imageshack.us/g/kolourpaintsmooth.png/

      --
      Silicon & Charybdis McLuhan Kildall Papert Kay
  4. short version by Trepidity · · Score: 5, Informative

    Most scaling algorithms treat brightness as a linear space, so e.g. if you're doing downscaling to 1/2 the size in each dimension, collapse 4 pixels into 1 by setting the 1 pixel to the numerical average of the original 4 pixels. But, most images are displayed with an assumption that brightness is a nonlinear space, i.e. gamma > 1. Therefore, scaling changes the perceived brightness, an unexpected result.

    1. Re:short version by evanbd · · Score: 2, Informative

      Brightness by itself is not a function, so it can't be linear or nonlinear.

      Displayed luminosity is a function of the data value in the image file, which is what the OP meant by brightness. And it most certainly can be linear or non-linear.

      But then, I suppose you already knew that.

    2. Re:short version by Anonymous Coward · · Score: 0

      So how is this news? What does it have to do on /. really? This is more something to discuss for graphics people, not for computer people like we are.

      It's not news. But the fact that you seem to think, as a "computer person", that you don't need to understand this, is an excellent reason for it to be posted. If you're writing a program that does anything non-trivial with graphics, you should at least be aware of these issues. (In many cases, you may just want to pretend that RGB values are linear, and that may be OK for some applications, but you should be aware that it's an oversimplification.)

      (But yes, Slashdot is obviously a totally homogeneous group, and I can't imagine that there would ever be an article posted here that would interest some readers and not others.)

    3. Re:short version by Anonymous Coward · · Score: 0

      Reading the comments I finally start to understand what tfs is trying to say.

      All and all I would not call this a bug. Also not a feature. It's an artifact at best. Bugs in the common use of the word are either small animals, or programming errors. This is neither. It's an algorithm that has certain artifacts, and some software (the long list in tfs) apparently uses a different algorithm.

      So how is this news? What does it have to do on /. really? This is more something to discuss for graphics people, not for computer people like we are.

      News for NERDS. Just sayin'. Also, who do you think wrote the graphics software?

    4. Re:short version by cynyr · · Score: 1

      also this would seem to only be an issue for downscaling, an increase in size by 100% in both directions should yield the expected result.

      --
      All of the above was encrypted with a Quad ROT-13 method. Unauthorized decryption is in violation of the DMCA.
    5. Re:short version by omnichad · · Score: 2, Informative

      No, it's an algorithm that's just plain wrong. It's doing linear calculations on values that represent an exponential curve. It's a pretty big screw-up, made by almost everyone that designs resampling algorithms. Given that graphics people don't usually write software, it's not for them. People that try to blend colors 0 and 255 in software need to know that the result should be 186 and not 127.

  5. Author expands scaling defination by Anonymous Coward · · Score: 0

    The author seems to think filtering is part of scaling which it is not. A "scaling" algorithm does not include low-pass filtering. The grey square shown is the correct result for a bicubic scale.

    1. Re:Author expands scaling defination by zippthorne · · Score: 1

      Yeah, I think it comes down to what the graphics files specify. This is the first I've heard that 24-bit color is logarithmic. I suspect that.. it isn't..though. If it is, then yeah, the scaling algorithms ought to have been taking it into account.

      Any time you're taking an average, you can hand-craft a set of points that average to whatever you want. The dalai picture doesn't really prove anything, only that a log/exponential scaling algorithm might have some interesting, perhaps even desirable results.

      --
      Can you be Even More Awesome?!
    2. Re:Author expands scaling defination by Anonymous Coward · · Score: 5, Funny

      I am sure the Chinese government prefers the current implementation.

    3. Re:Author expands scaling defination by scdeimos · · Score: 2, Informative

      You're absolutely correct, AC. The reported issue isn't about a linear/nonlinear gamma bug at all - it's an averaging side effect.

      The sample Dalai Lama image on TFA's page is intentionally constructed of interlaced lines of red and green data to thwart the averaging of source data used in common scaling algorithms. If you use the Gimp with the "None" scaling method, which will just pick-up every other row and column when scaling by 50%, (instead of trying to average 2x2 grids) you get a mostly-green image instead of the grey image advertised.

    4. Re:Author expands scaling defination by Anonymous Coward · · Score: 0

      Somebody needs to mod the parent comment funny.

    5. Re:Author expands scaling defination by Schraegstrichpunkt · · Score: 1

      RTFA. There are more realistic examples given, and it makes a visible difference.

    6. Re:Author expands scaling defination by kappa962 · · Score: 1

      Unless I seriously misread TFA, this error has nothing to do with the spectral content of the data. Spectral content certainly influences the way things scale, but it seems to have no connection to this particular bug.

      Look at the test picture in the "Explanation" part of the article. http://www.4p8.com/eric.brasseur/gamma.html#explanation Filtered or not, the test picture should not result in the second column being dark grey.

    7. Re:Author expands scaling defination by eelke_klein · · Score: 3, Informative

      Actually a good scaling algorithm should perform a lowpass filter when downscaling. This is similar to downsampling of digital audio where you do need to filter out frequencies above half the sampling rate. Leafing these higher frequencies in would cause noise because they can not be faithfully represented in a lower resolution file.

    8. Re:Author expands scaling defination by eelke_klein · · Score: 1

      Among graphics specialists it has been well known it is not linear. However many people think it is linear because most of the time you can get away with it. But if you make a grid of black and white pixels and a square of pixels with a value of 127 you can easily see there is a significant difference where you wouldn't expect one.

    9. Re:Author expands scaling defination by Anonymous Coward · · Score: 2, Interesting

      a low pass filter wouldn't work per se, as the color encoding used is non linear. most filters instead takes each channel of the picture producing an area average akin to a lowpass filter, but this is exactly where the problem lies as a: checkered black and white image (that is, every odd pixel on one row is white and the others black, reversed on the next row) is averaged to a contiguous half tone gray image, which is not the expected result because the gray scale is not linear in terms of luminance, so you'll need to have it averaged to a rgb(180,180,180) instead that to a rgb(128,128,128)

      *180 is not the actual value

    10. Re:Author expands scaling defination by Anonymous Coward · · Score: 0

      You have completely missed the point.

      The scaling algorithm when the wrong gamma is used simply determines if the output is gray, green or pink.

      The scaling algorithm when correct gamma is used has no effect at all - it will just determine how blury the image is.

  6. This isn't really a bug by Cassini2 · · Score: 3, Insightful

    This is only a bug depending on what you are doing with your final images. One of the things that annoys me is that many image manipulation programs do not actually explain the primitives they are using. The result can be a complete mess depending on what you are trying to accomplish. This article is an example of this effect.

    If you want photo-realistic results, then you need to take Gamma into account. However, very few file formats specify the Gamma, the grey level, the white level, the black level or the colour space of the original image. The result is that the many imaging operations must be wrong, as they can never be accomplished the way intended. For the most part, no one cares. This person found an application where people care.

    1. Re:This isn't really a bug by johndoe42 · · Score: 5, Informative

      But most people who use images expect to look at them eventually. And most image files are meant to be viewed at gamma 2.2. (Printer drivers will at least approximately emulate a gamma of 2.2, and LCDs emulate it intentionally.) If you view the image at some other gamma, you don't see quite what was intended.

      Another way of looking at it is that most standard image formats are stored with a nonlinear representation, and people who do math should realize that. For an untagged image, gamma=2.2 is a good bet. gamma=1.0 is a terrible bet.

      Of course, if we really want our software to do a good job, then that software should be aware that specifying colors like #FF0000 isn't a good idea -- they look very different on different screens. What the user probably meant to do was specify a particular color, which means that the numbers need to be marked with a color space. (For a great demo, get an HP LP2475w or some other good wide-gamut display, don't install a profile, and look at anyone's photo album. Everyone looks freakishly red-faced.)

    2. Re:This isn't really a bug by dimeglio · · Score: 2, Insightful

      Well if it's a 20 year old bug, it should be renamed to a feature and patented. "Method to produce photo realistic scaling without taking gamma into account."

      --
      Views expressed do not necessarily reflect those of the author.
    3. Re:This isn't really a bug by Anonymous Coward · · Score: 0

      Actually I've seen some of these images in Futaba(the BBS 4chan's derived from). When I try to open, say, a NSFW thumbnail, it turns into maccho guy. ouch. It's quite...... common.

    4. Re:This isn't really a bug by Anonymous Coward · · Score: 0

      However, very few file formats specify the Gamma, the grey level, the white level, the black level or the colour space of the original image.

      I would wager most RAW files specify the above. To be more exact, DNG does the black & white levels, the colour space, gamma, and even Photometric Interpretation. NEF has the ability to define it, but I'm away from my camera and thus unable to check for sure (I do know it allows you to specify the colour space). Thus anyone who processes RAW files will have this issue when they should not.

    5. Re:This isn't really a bug by uglyduckling · · Score: 1

      As has been pointed out elsewhere, even using a gamma of 2.0 (i.e. the root of the mean of the squares) would be a better compromise, and split the difference (sort-of) between 1.8 and 2.2. That would certainly produce better results than presuming a gamma of 1.0, and wouldn't be a huge programming or computation overhead. This bug is akin to a circuit simulator presuming that the total resistance of several resistors in parallel can be approximated to the arithmetic mean.

    6. Re:This isn't really a bug by noidentity · · Score: 1

      However, very few file formats specify the Gamma, the grey level, the white level, the black level or the colour space of the original image.

      In general, one should assume sRGB unless the file/format specifies otherwise.

    7. Re:This isn't really a bug by Anonymous Coward · · Score: 0

      This person found an application where people care.

      Somehow I'm not going to believe this statement... Since this is just a minor edge case. Interesting find nevertheless.

    8. Re:This isn't really a bug by Anonymous Coward · · Score: 0

      I remember coding something in java (Write once run anywhere, right?) where I used system constants for color. To my surprise the app looked totally different at home (win/pc) and college (sparc/solaris) even tried it on MAC's to yet a different result. So I can understand the need for calibration. Even using numeric RGB values produced different results depending on the monitor used.

    9. Re:This isn't really a bug by Waccoon · · Score: 2, Insightful

      I'm a cartoonist who runs a web comic, and I've known about this problem for years.

      To cut bandwidth, I have a set palette of indexed colors that I use as a base for each strip, and I pick a few extra colors to finish the anti-aliasing. It doesn't take as much effort or time as it sounds, and it cuts bandwidth considerably compared to a trucolor PNG, and doesn't have the artifacts of a JPEG.

      However, I noticed that when I reduced one of my strips in size, the brightness always changed, so when I applied my custom palette, I got weird results. I had to develop a masking technique to get around this.

      Photographers may not notice the problem, but for those who explicitly select a set palette, this has been a major issue for a while. It's too bad that graphics applications are so focused on photography that cartooning, especially coloring, is actually very difficult.

    10. Re:This isn't really a bug by Anonymous Coward · · Score: 1, Interesting

      Why should the scaling algorithm take into account the display's gamma? That should be the function of the display hardware and/or driver to accurately depict the luminosity of 0-255 (or 0-4095 for 12 bit displays), not the software. If the imagery is to be used for scientific uses, one does not want the resampling to tweak the values as suggested in the article. In his example of a 50% reduction of a 4x4 square, the arithmetic mean of 127 is the correct value if the reduced image is going to be fed into a process were 0-255 do not represent display brightness values, but some other values entirely. That way the user should be able to display the image on different devices, with different gamma values and not have mess around with the original data.

    11. Re:This isn't really a bug by clone53421 · · Score: 1

      This bug is akin to a circuit simulator presuming that the total resistance of several resistors in parallel can be approximated to the arithmetic mean.

      Gray is still between black and white. The combined resistance of parallel resistors is not somewhere between their individual resistances; it is less than either resistance alone.

      It’s more like a circuit simulator presuming that the total resistance of two resistors in parallel can be approximated by half the mean. Close, but not quite:

      100 ohm | 100 ohm = 50 ohm (the approximation would give 50 ohm)
      100 ohm | 90 ohm = 47 7/19 ohm (the approximation would give 47½ ohm)
      100 ohm | 50 ohm = 33 1/3 ohm (the approximation would give 37½ ohm)
      100 ohm | 10 ohm = 9 1/11 ohm (the approximation would give 27½ ohm)
      100 ohm | 0 ohm = 0 ohm (the approximation would give 25 ohm)

      --
      Alexander Peter Kristopeit bought his basement from his mommy for one dollar.
    12. Re:This isn't really a bug by Anonymous Coward · · Score: 0

      That’s not a gamma trick, it’s a PNG transparency trick.

      The thumbnail is rendered on a black background; transparent parts of the original PNG look black. Opaque black shapes will not contrast against the transparency around them. White shapes, however, will show up perfectly on the black background.

      When you view the PNG itself, transparency looks white because that’s the background colour of the window. As a result, the white shapes that were visible against the black background of the thumbnail will vanish completely, but the opaque black that was invisible in the thumbnail will show up against the white background.

      In other words, the thumbnail is black, plus whatever partially-opaque white you use to create shades of gray. The full-sized image is white, plus whatever partially-opaque black you use to create shades of gray. A opaque gray pixel would be the same colour in both. A partially-opaque gray pixel would be darker in the thumbnail, so it’s impossible to make a pixel that’s lighter in the thumbnail than it is in the large picture except by using opaque white pixels around it to average the colour value lighter when it’s sized down to the thumbnail size.

      At least, that’s the only trick I’m aware of. Maybe there’s also a gamma trick that I haven’t figured out yet.

      I’d post a sample image, but I don’t have one with me. Besides, the pixels that show up on a white background look like goatse on all of the ones I’ve made so far.

      If you want to create a sample yourself, it’s easy to do so. Take your full-sized image (goatse), desaturate (grayscale) it, and convert white to alpha (transparency). Take the “when you see it” motivational border, add an alpha channel, and erase the interior of the rectangle (to transparency). Paste this border around the full-sized image so it frames it. You will now have an opaque border surrounding a grayscaled image with a transparent background. Viewed full-size in a browser window, the transparent background will be white, but in the thumbnail, the interior of the motivational frame will be entirely black.

    13. Re:This isn't really a bug by uglyduckling · · Score: 1

      Sure. Although I did have a 'teacher' at school who wouldn't believe me about the above... I had to actually use a multimeter to prove to him that 1/r=1/r1 + 1/r2 cannot be approximated to r=(r1+r2)/2.

  7. HA! by TheDarkener · · Score: 5, Funny

    Well, I am SURE glad I'm using Linux^H^H^H^H^HWindows^H^H^H^H^H^H^HMac^H^H^Hshit.

    --
    It is pitch black. You are likely to be eaten by a grue.
    1. Re:HA! by rafaelolg · · Score: 1

      I tried with ImageMagick convert and it is not as bad as the firefox resize or the eye of gnome and gimp. One can still see the Dalai Lama after "convert -resize 50%" .

    2. Re:HA! by Anonymous Coward · · Score: 0

      I use shit too!

    3. Re:HA! by Anonymous Coward · · Score: 0

      Well, I am SURE glad I'm using Linux^H^H^H^H^HWindows^H^H^H^H^H^H^HMac^H^H^Hshit.

      Actually, since Preview (the default Apple image viewer) and Aperture (the fancy $$$ Apple image manager) are not affected, I'd say this is a win for ColorSync, and by extension, the Mac and its use in all things graphical.

    4. Re:HA! by moosesocks · · Score: 2

      Actually, according to TFA, Apple's built-in toolkits (used by Aperture and Pixelmator) seem to be immune to this bug. Photoshop ceased being a mac-like application a very long time ago.

      This is one of many reasons why creative professionals prefer macs over PCs --- and I'm not saying this as platform evangelism -- for one, you'd be hard pressed to disagree that Mac OS X's font-rendering, kerning, and anti-aliasing abilities are far superior to those provided by Windows when presented with side-by-side examples. It's lots of little things (many of which likely took the programmers a great deal of time to get right) that make the platform so nice to work with. Likewise, Adobe is quickly exhausting its remaining good will with the graphic design community, as recent Photoshop releases have declined significantly in quality, and have generally added little value to the application, as well as the abomination that is the Flash player.

      I haven't checked Win7 yet, but as of Vista, Windows still presented windows-3.1-style dialog boxes when adding fonts. Although this is a fairly superficial example, it provides a great example of Microsoft's general neglect of its existing codebases. Once a feature becomes "stable," it rarely if ever gets refined or tweaked in subsequent releases, while poorly-integrated features get piled on top (although it must be said that when Microsoft finally does choose to overhaul part of the UI, they generally do a pretty good job of it. IE7 and 8 are notable exceptions, and actually seem to have been made intentionally confusing -- even the KDE, GIMP, and Blender folks would struggle to make a UI so cryptic, inconsistent, and foreign-looking)

      --
      -- If you try to fail and succeed, which have you done? - Uli's moose
    5. Re:HA! by Korin43 · · Score: 4, Funny

      Well I tested the site in lynx and I didn't see any problems..

    6. Re:HA! by Mr2001 · · Score: 5, Informative

      This is one of many reasons why creative professionals prefer macs over PCs --- and I'm not saying this as platform evangelism -- for one, you'd be hard pressed to disagree that Mac OS X's font-rendering, kerning, and anti-aliasing abilities are far superior to those provided by Windows when presented with side-by-side examples.

      Mac OS X's font rendering is different , but calling it "far superior" is simply platform evangelism.

      OS X renders text so that the on-screen representation looks more like the printed representation, which is good for tasks like designing print advertisements (where you want to approximate the finished product as closely as possible). Windows takes liberties with the shape and spacing of on-screen text in order to line it up with the pixel grid, which is good for tasks like word processing and programming (where legibility on screen is more important). When you're used to Windows, Mac text looks blurry; when you're used to the Mac, I imagine Windows text looks thin and lanky.

      --
      Visual IRC: Fast. Powerful. Free.
    7. Re:HA! by onefriedrice · · Score: 1

      Well, I am SURE glad I'm using Linux^H^H^H^H^HWindows^H^H^H^H^H^H^HMac^H^H^Hshit.

      Ha! It sure is great being a BSD user. I mean, sure, it sucks kinda to use a dead operating system... but at least none of my imaging software has bugs that plague lesser operating systems, right?... right?

      --
      This author takes full ownership and responsibility for the unpopular opinions outlined above.
    8. Re:HA! by Anonymous Coward · · Score: 2, Interesting

      > When you're used to Windows, Mac text looks blurry

      If you're programming in OS X and antialiased text annoys you, simply turn it off. Many editors support disabling it. Then you use a font, such as Monaco, that has been hand-tweaked at the right sizes for screen display and everything looks great, no blurriness.

    9. Re:HA! by MobileTatsu-NJG · · Score: 1

      This is one of many reasons why creative professionals prefer macs over PCs

      No, it's not. Nobody even knows about this bug.

      --

      "I like to lick butts!" by MobileTatsu-NJG (#32700246) (Score:5, Informative)

    10. Re:HA! by Anonymous Coward · · Score: 0

      Well, I am SURE glad I'm using Linux^H^H^H^H^HWindows^H^H^H^H^H^H^HMac^H^H^Hshit.

      Where did you get this shit of which you speak?
      I am very interested in analyzing it and check it for bugs.

    11. Re:HA! by Anonymous Coward · · Score: 0

      This is one of many reasons why creative professionals prefer macs over PCs

      macs are PCs...

    12. Re:HA! by Anonymous Coward · · Score: 0, Flamebait

      Mac OS X's font rendering is different [joelonsoftware.com], but calling it "far superior" is simply platform evangelism.

      It's not platform evangelism when it is general consensus among experts, that is, typeface designers and font engineers, that one remains true to what was originally intended.

      The same issue occurs with color calibration in displays--consumers often prefer the "dynamic" or oversaturated modes on their televisions, at the expense of proper calibration and color gamut matching. A calibrated display is far superior than one that is not.

      It may be a particular user's subjective preference to use the uncalibrated display, and there is nothing wrong with that. But it is plainly inferior in any technical analysis.

      Same with Windows font rendering. It is plainly inferior in all objective measures of typeface fidelity. A preference for the Windows style, arising mainly out of familiarity, is perfectly fine.

      Subjective taste is subjective. Measurably fidelity is not, and handwaving about one being suited more to a given task than another doesn't make it so.

      Windows takes liberties with the shape and spacing of on-screen text in order to line it up with the pixel grid, which is good for tasks like word processing and programming (where legibility on screen is more important)

      The link you provided does not support that argument. Legibility is not a significant issue. The difference is one of comfort and familiarity.

      I personally find that working in Windows-based terminals on LCD monitors is far more straining than Mac-based ones or CRT monitors--the text is too sharp and loses distinctiveness. The image in Spolsky's article clearly shows that effect...the upper line (Apple) is far more legible to me. Others may be accustomed to something else, and that's fine, but it's flat-out falsehood to claim that grid priority makes for better onscreen legibility.

      One is not more suited to anything than the other, with the exception being that the Mac's system is more suited to remaining true to the typeface design.

    13. Re:HA! by brusk · · Score: 1

      I personally find that working in Windows-based terminals on LCD monitors is far more straining than Mac-based ones or CRT monitors--the text is too sharp and loses distinctiveness.

      You do realize that this is configurable....?

      --
      .sig withheld by request
    14. Re:HA! by Anonymous Coward · · Score: 0

      No, it's not. The subpixel methodology is fixed. The settings are configurable, but not the method.

    15. Re:HA! by ByteSlicer · · Score: 1

      Well, I am SURE glad I'm using Linux^H^H^H^H^HWindows^H^H^H^H^H^H^HMac^H^H^HEmacs.

      There, fixed that for you.

    16. Re:HA! by Anonymous Coward · · Score: 0

      Shit is right... no one in their right mind would go from Linux to Windows. Linux to OSX maybe, but not Windows.

    17. Re:HA! by Mr2001 · · Score: 3, Insightful

      Same with Windows font rendering. It is plainly inferior in all objective measures of typeface fidelity.

      Like I said, that's because fidelity isn't the primary goal. Windows goes out of its way to distort rendered text in order to align the character outlines with pixel boundaries.

      You might as well claim that donuts are "plainly inferior in all objective measures of bagel quality": they crumble apart when you try to spread anything on them, you can't buy them pre-sliced, none of them come with raisins inside... and that's all fine, because donuts aren't trying to be bagels.

      Subjective taste is subjective. Measurably fidelity is not, and handwaving about one being suited more to a given task than another doesn't make it so.

      Once again, you're assuming fidelity is the only goal of a font renderer, but that's not the case.

      When you take a font designed to be printed at 600 DPI and render it on a 96 DPI screen where each character is only a few pixels high, you face a tradeoff between fidelity and legibility. Apple decided to prioritize fidelity; Microsoft decided to prioritize legibility.

      The link you provided does not support that argument. Legibility is not a significant issue.

      Perhaps you missed this part: "Microsoft generally believes that the shape of each letter should be hammered into pixel boundaries to prevent blur and improve readability, even at the cost of not being true to the typeface."

      I personally find that working in Windows-based terminals on LCD monitors is far more straining than Mac-based ones or CRT monitors--the text is too sharp and loses distinctiveness.

      Fair enough. That's a matter of subjective taste.

      Others may be accustomed to something else, and that's fine, but it's flat-out falsehood to claim that grid priority makes for better onscreen legibility.

      At the point size in the article's example? Yes, you're right, both lines are legible.

      But at smaller sizes, it's a plain statement of fact: distorting characters to keep the lines distinct does indeed make for more legible text than accurately rendering them into amorphous blobs.

      --
      Visual IRC: Fast. Powerful. Free.
    18. Re:HA! by Anonymous Coward · · Score: 0

      and Linux?

    19. Re:HA! by Anonymous Coward · · Score: 0

      --- and I'm not saying this as platform evangelism -- for one, you'd be hard pressed to disagree that Mac OS X's font-rendering, kerning, and anti-aliasing abilities are far superior to those provided by Windows when presented with side-by-side examples.

      Ever looked at the font-rendering, kerning, and anti-aliasing in a well configured Linux-system. It make Mac OS X look like shit. It takes some twiddling to get it right in both systems and Mac OS X, delivered with a standardised hardware(*), usually has a better default configuration. But Linux could be superior out of the box, if if it were bundled with computers that had decent hardware and was well configured and it still looks good enough on hardware where OS X would look like a disaster.

      (*) As proved by running Apple software on non-Apple hardware.

    20. Re:HA! by bheer · · Score: 1

      you'd be hard pressed to disagree that Mac OS X's font-rendering, kerning, and anti-aliasing abilities are far superior to those provided by Windows when presented with side-by-side examples.

      That's _your_ opinion. For me, Windows's rendering looks great (OS X looks 'fuzzy' to me). I know my philistinism may hurt typography geeks, but really, most people don't care.

    21. Re:HA! by Anonymous Coward · · Score: 0

      Forgot to mention why a (well configured) Linux system look better than Mac and Windows when it comes to font rendering.

      Linux (freetype) use a "greyscale" of 256 shades when drawing glyphs. Mac and Windows use something like 5 or 6. Thats why Linux look better despite using simpler and faster algorithms. Apple and Microsoft made a bet on the wrong horse and thought it would be better with insanely complicated drawing algorithms.

    22. Re:HA! by Erikderzweite · · Score: 1

      on a related note, I can see Dalai Lama in links2. The picture is not scaled though.

    23. Re:HA! by pizzach · · Score: 1

      When you're used to Windows, Mac text looks blurry; when you're used to the Mac, I imagine Windows text looks thin and lanky.

      You hit the nail on the head. When using a Mac for a while, Windows fonts start to look like they are not antialiased at all. I actually have to turn cleartype off ot make sure it is actually making a difference.

      --
      Once you start despising the jerks, you become one.
    24. Re:HA! by Anonymous Coward · · Score: 2, Insightful

      Like I said, that's because fidelity isn't the primary goal.

      Talk about changing the goalposts! This whole Slashdot story is about fidelity.

      You might as well claim that donuts are "plainly inferior in all objective measures of bagel quality"

      No, I'm pretty sure that font display is measured by fidelity to the creator's intention and design, just as photographic display is being measured by fidelity to accurate gamma values in TFA.

      Unless you're saying a typeface stops being a typeface when it shows up on a screen and becomes a...bagel, I think you're being evasive.

      The technical ins and outs of photo editing and display are all about fidelity; why would that not be the case with typeface rendering and display?

      Once again, you're assuming fidelity is the only goal of a font renderer, but that's not the case.

      And again, this is the most bizarre argument I've ever heard.

      That's like saying rendering the proper color gamut isn't the purpose of a monitor. Or that fidelity to the original source material isn't the purpose of speakers.

      Perhaps you missed this part: "Microsoft generally believes that the shape of each letter should be hammered into pixel boundaries to prevent blur and improve readability,

      No, but there's nothing to back up that statement of belief with reality, and in fact the results clearly show it not to be an issue. So the question is, if Microsoft had bothered to put some effort into proper rendering, would there be any meaningful loss of legibility?

      Empirically, the answer is obviously "no". As even that article points out, the determining factor is familiarity.

      Moreover, "blur" is not a bad thing. Smoothness of form is a critical element of successful typeface design. The ungainly reproduction of Microsoft's snap-to-grid shortcut ruins the flow of the best and most famous typefaces, hindering legibility.

      Why the article pretends that Microsoft's decision was anything other than lack of interest in fine-tuning is rather curious. It wasn't a conscious decision about legibility that led them here--it was instead a desire not to alienate what had become familiar by 1998 when ClearType started to take shape. Spolsky is neither a typographer nor a neutral commentator--he has an open preference for ClearType and no formal training in typeface design or in perceptual optics.

      When you take a font designed to be printed at 600 DPI and render it on a 96 DPI screen where each character is only a few pixels high, you face a tradeoff between fidelity and legibility.

      A false dichotomy.

      Pixel grid rendering is simply easier to implement; it is not quantifiably better in any way. Its distortion of precisely designed typeface lines interferes with the expert, the typeface designers and font engineers who not only carefully construct the aesthetics, but also the science.

      Microsoft commissioned fonts to work with their rendering technology to improve readability--had their system provided an overall advantage in actual legibility, such an effort would have been redundant. In fact, Verdana (and related fonts) exists to address the typographical shortcomings of ClearType.

      The fact of the matter is that the article provides nothing to suggest that legibility is improved with the Microsoft method, and provides both the empirical counterexample and the "Verdana paradox".

      But at smaller sizes, it's a plain statement of fact: distorting characters to keep the lines distinct does indeed make for more legible text than accurately rendering them into amorphous blobs.

      Setting aside for the moment the serious legibility issues of using small font sizes period for extensive work, that's the reason why subpixel rendering is disabled at a certain font size (default on OS X is 8pt;

    25. Re:HA! by moonbender · · Score: 1

      The difference between images/gamma and fonts/fidelity is pretty simple. With images, in general the single goal is an accurate representation of the image on your viewing device. This is because the purpose of the image is to be looked at. With fonts, fidelity is NOT the single goal since the font itself serves a further purpose: it encodes a text, which's purpose is to be read. So the primary goal of a font is to be legible. Being true to the font designers idea is secondary.

      Of course, you claim that legibility vs. fidelity is a false dichotomy. Not only that, but you claim the opposite: high fidelity is also high legibility. If that's true, then the algorithm should be optimised to give fidelity. However, you also agree that at low font sizes, optimising for fidelity gives poor results, so clearly, the two goals don't align in every situation. I don't see why the principles that apply at low font sizes wouldn't apply to large fonts as well, to a much lesser degree, but still. So claiming it's a false dichotomy seems disingenuous.

      --
      Switch back to Slashdot's D1 system.
    26. Re:HA! by Mr2001 · · Score: 5, Informative

      No, I'm pretty sure that font display is measured by fidelity to the creator's intention and design

      And I'm pretty sure you're wrong. Sorry. You might choose to measure font rendering that way--fidelity at any cost, even if it means reducing text to illegible blobs--but I don't, and evidently Microsoft doesn't either. In fact, I'd wager that most people don't.

      The technical ins and outs of photo editing and display are all about fidelity; why would that not be the case with typeface rendering and display?

      Because in many (if not most) cases, the primary purpose of rendering text is to make that text readable to the person sitting in front of the screen, and the formatting of that text is a secondary concern. In such cases, making "click here" distinguishable from "dick here" is more important than preserving the font designer's artistic vision.

      So the question is, if Microsoft had bothered to put some effort into proper rendering, would there be any meaningful loss of legibility?

      Empirically, the answer is obviously "no". As even that article points out, the determining factor is familiarity.

      Again, this is only true if you ignore what happens at small sizes.

      Why the article pretends that Microsoft's decision was anything other than lack of interest in fine-tuning is rather curious. [...] Pixel grid rendering is simply easier to implement

      Nope, you've got it backwards: Microsoft's approach involves more fine-tuning. Apple's approach is easier to implement: just scale the outline to the appropriate size and fill it in.

      Again, font rendering is measured by fidelity to the creator's intent. If the typeface is illegible because of blurring, then it's a poor typeface.

      Nonsense. A font that looks fine when rendered in a 15-pixel-high line (on a 300 DPI printer) may look illegible when rendered unchanged in a 5-pixel-high line (on screen). That doesn't mean the typeface is poor, it just means it's too intricate for such a low resolution.

      But Microsoft's decision to abandon the design in favor of a simplistic snap-to-grid renderer does nothing to improve legibility.

      You seem to be confused about how that renderer works. It's far from "simplistic snap-to-grid": simply snapping the font's vertices to a pixel grid would produce garbage. What it actually does is apply the TrueType hints found in the font file.

      The OS X font renderer ignores nearly all the hints, which is why the outline it renders at small sizes looks the same as the one it renders at large sizes: the hints are placed there by the font creator to tell renderers how to distort the outline at small sizes.

      (Indeed, Microsoft's ClearType renderer pays less attention to the hints than their old one, because the greater resolution of subpixel rendering makes horizontal pixel-fitting less important.)

      I happen to be of the print publication era, and I cannot stand the state of Microsoft and Linux font rendering. I'm happy to concede those with a personal and subjective preference for that system, but the reality is that it is objectively inferior in every way.

      No, not in every way; only in the particular way you've chosen to focus on. Your personal, subjective preference is showing.

      --
      Visual IRC: Fast. Powerful. Free.
    27. Re:HA! by David+Jao · · Score: 3, Interesting

      Talk about changing the goalposts! This whole Slashdot story is about fidelity.

      Woah there. First of all, as a neutral party, I dislike both Apple and Microsoft (I use Linux), and I have no agenda here. However, I do think that your viewpoint (as a self-admitted print publisher) is highly biased and useless to the majority of slashdot readers. This slashdot story is about image editing, but this thread is about on-screen font rendering. The two topics are different, and they need different goalposts.

      The technical ins and outs of photo editing and display are all about fidelity; why would that not be the case with typeface rendering and display?

      Viewing a photo is very very different from reading text. In fact, I find it completely preposterous that anyone would regard the two things as having anything in common.

      When I am reading text, I care about text fidelity, not image fidelity. I want to know what the letters and words are. I want to be able to read and re-read the text with minimal eyestrain. Unless you work in advertising or marketing (two industries which I loathe), the purpose of displaying or printing text is to accurately convey which letter is which and which word is which. Anything else (such as font accuracy) is only a means to this end. Anyone (such as you) who thinks font accuracy is worthy as an end in itself is clearly living in a different world from someone (such as me) who reads scientific papers (the vast majority of them on-screen, simply because carrying around 1GB worth of printed papers is impossible) and writes code for a living.

      I'm no great lover of Apple products, but as someone in print and publishing, this is one thing Apple does right and everyone else refuses to.

      There is a huge difference between printed text and text on a computer screen. The physical differences between the two are so vast, they can never be made to display exactly the same. I understand that, for someone like you who works in the publishing industry, it is important for computer screens to maintain fidelity to printed paper, since the printed paper is your end result. However, just because your profession depends crucially on font fidelity, does not mean that the same holds for other people.

      You need to understand that text on a computer screen is not always intended for publication on a printed page. Computer programming, in particular, involves writing large amounts of textual code, code which is almost never printed. Many slashdot readers are computer programmers, and couldn't give a flying f*ck about printing out their source code on paper. In such a situation, it is counterproductive to insist on image-level fidelity between text displayed on a computer monitor and text printed on a paper page. In fact, the optimal display strategy for computer programmers is almost completely the opposite of what you are saying, namely: render the font on the computer monitor so that it is as readable as possible on a computer screen, with absolutely zero regard for fidelity to printed output.

      Scenes intentionally filmed with judder that people go to great lengths to smooth out; proper calibration that is blown away by dynamic settings; sound mix and dynamic range that is hopelessly trampled by bass-loading equalizer fiends; photos being displayed in some other color space are all the same issue.

      Ironically, text rendering is the one issue that is different from all of the above. Text is a discrete medium: a letter is either an a, b, or c, or so on. Photos, sound, and video are analog media, perceived along a continuum by the human brain. Text fidelity means only one thing: being able to tell letters apart.

      If you were to print out Microsoft's rendered fonts in a novel, people would demand a reprint by the publisher. The objective reference is the superior reference.

    28. Re:HA! by uglyduckling · · Score: 1

      That's like saying rendering the proper color gamut isn't the purpose of a monitor. Or that fidelity to the original source material isn't the purpose of speakers.

      I'm a Mac user, and I happen to agree with your basic arguments, but I do think you've missed the point that there may be different standards to measure hardware by in different contexts. I want my LED Cinema Display to be accurate with perfect gamma. I don't care so much about the display in my MacBook - I would trade-off plenty of accuracy for good operation in sunlight and power efficiency; the monitor for my MythTV PC in the living room is set-up to give punchy over-saturated pictures because that suits the films I enjoy and makes it bright even when my wife has all the lights on in the living room. I want the speakers in my home studio to have excellent fidelity to the source material, but the Bose Lifestyle system hooked up to my MythTV setup is aweful in terms of fidelity - but it sounds great for an action movie and is unobtrusive in the living room.

    29. Re:HA! by pbhj · · Score: 1

      http://www.4p8.com/eric.brasseur/gamma_dalai_lama.html displays all images identically in links2 using the svgalib driver, but it doesn't scale them so it would whether it has the bug or not.

    30. Re:HA! by Anonymous Coward · · Score: 0

      I find it absurd that anyone would justify a font rendering algorithm that doesn't actually render typefaces.

      If legibility is a concern, why not just substitute a different screen font instead of going at it half-assed.

    31. Re:HA! by Anonymous Coward · · Score: 0

      At the point size in the article's example? Yes, you're right, both lines are legible.

      But at smaller sizes, it's a plain statement of fact: distorting characters to keep the lines distinct does indeed make for more legible text than accurately rendering them into amorphous blobs.

      Can I get an amen? And maybe an open source PDF reader?

    32. Re:HA! by wfolta · · Score: 1

      When I am reading text, I care about text fidelity, not image fidelity. I want to know what the letters and words are. I want to be able to read and re-read the text with minimal eyestrain. Unless you work in advertising or marketing (two industries which I loathe), the purpose of displaying or printing text is to accurately convey which letter is which and which word is which. Anything else (such as font accuracy) is only a means to this end. Anyone (such as you) who thinks font accuracy is worthy as an end in itself is clearly living in a different world from someone (such as me) who reads scientific papers (the vast majority of them on-screen, simply because carrying around 1GB worth of printed papers is impossible) and writes code for a living.

      I find claims of eyestrain on Mac displays to be rather far-fetched. Between work and home, I spend 12-16 hours a day in front of Mac monitors and have zero eyestrain. (And this is after 30 years in programming and videography, sitting in front of computer screens all day.)

      Font accuracy, as you call it, is not an end in itself, for most of us. It's much like stairs: the rise of each step must be within a few millimeters of the others, or it will throw your feet off. Similarly, fonts which have been warped to fit the pixels throw reading stride off, and also create artifacts that are distracting. Fonts have been developed over centuries and reflect many human factors that affect your reading experience more than some abstract "font accuracy" criterion. This is not some kind of Print Nazi thing where the screen must match paper for reasons of "purity" or something.

      For programming, I use one or two specific fonts. In that task, I want monospaced fonts, obviously, and that actually reinforces the idea that character stride is important, not just hitting pixel boundaries. (In this case, the two coincide, but hopefully it's clear that for other tasks, a different kind of stride is necessary and pixel boundaries may not be right.)

      I simply do not sit so close to the screen (or use a low-enough-rez screen) that I can see individual pixels, so I cannot see any "blurring" in Mac fonts. I can see that once you're used to the overly-sharpened Windows fonts, you might perceive Mac fonts as "blurry", but that's like people who are used to radio pop music that's over-compressed and has the high and low ends pumped way up and then they listen to real music and find it "mushy and bland". Or to use a closer analogy, it's like someone who insists on Sharpening and Contrasting up all photos, who gets used to the over-sharp, artifacted look and regard anything less as "blurry and dull".

    33. Re:HA! by David+Jao · · Score: 1

      I find claims of eyestrain on Mac displays to be rather far-fetched. Between work and home, I spend 12-16 hours a day in front of Mac monitors and have zero eyestrain.

      Sure, eyestrain is a very subjective topic. What I'm disputing is the GP's assertion that font rendering should be measured according to objective standards. Unless you're in a (worthless) industry like advertising where the medium is more important than the message, the "correct" or "best" rendering technique for text is very subjective. For a given person, the best font rendering may even vary from one monitor to another.

      I wouldn't mind a system that lets you choose between Mac-style or Windows-style font rendering. What I do mind is other people telling me that Mac fonts are better, when my own eyes disagree. If you think that Mac fonts are better to you, I'm not going to try to correct you. I would appreciate the same courtesy in return. And I certainly disagree vehemently with the GP's claim that there is one "objective" standard against which all rendering systems should be measured.

      Similarly, fonts which have been warped to fit the pixels throw reading stride off, and also create artifacts that are distracting. Fonts have been developed over centuries and reflect many human factors that affect your reading experience more than some abstract "font accuracy" criterion.

      These two statements are virtually contradictory. Coarse resolution backlit monitor displays certainly have not existed for centuries, so the centuries-long history of font development is completely irrelevant in this context. The fact is, computer screens are extremely new by historical standards (even more so in the case of LCD monitors), and they may well require dramatically different display strategies and font rendering compared to traditional media. To me, the "warped" fonts and display artifacts that you dislike are something that I find extremely positive. They are a necessary and worthwhile tradeoff on low-resolution backlit displays in exchange for the benefit of having super-sharp text. Indeed, since computer monitors are so astoundingly different from any other historical display technology, adhering to centuries-old ideas about font rendering, ideas which were developed and optimized for a completely different display medium, makes absolutely zero sense, and more likely than not is actually counterproductive.

      I simply do not sit so close to the screen (or use a low-enough-rez screen) that I can see individual pixels, so I cannot see any "blurring" in Mac fonts.

      That's your opinion, and I respect it. Please return the favor and respect mine. In my opinion, any screen less than 300 dpi (the bare minimum resolution considered tolerable for print) is low resolution and benefits from pixel re-alignment. I would be extremely surprised if you had a computer monitor with 300 or more dpi.

    34. Re:HA! by Ant+P. · · Score: 1

      When you've used Linux long enough, they both look bad. But Windows' blurry rainbow-frilled text is definitely worse.

    35. Re:HA! by jimicus · · Score: 1

      and Linux?

      And Linux (or, more accurately, X plus your desktop environment) allows you to specify precisely how you want everything rendered in excruciating detail.

      There is precisely one person on the planet who cares about this. Everyone else complains that the font rendering looks like arse. Which it does because no effort has been made to ensure that when in doubt, sensible defaults are used. The author didn't bother because - well, what's the point when the user is obviously going to configure it to their liking anyway?

    36. Re:HA! by Mr2001 · · Score: 1

      I find it absurd that anyone would justify a font rendering algorithm that doesn't actually render typefaces.

      Well, arguably Microsoft's algorithm is truer to the font designer's intent, since it goes by the TrueType hints which were placed there by the font designer. Apple's algorithm produces small letters on screen that look more like the small letters on a printed page, but it does that by ignoring some of the information in the font (i.e. the instructions on how to distort the font for on-screen display).

      If legibility is a concern, why not just substitute a different screen font instead of going at it half-assed.

      Because then all small text would look the same. Going by the hints, there's at least some distinction between different typefaces - just not as much as at larger sizes.

      --
      Visual IRC: Fast. Powerful. Free.
    37. Re:HA! by Anonymous Coward · · Score: 0

      I use a mac. I love it. Everything except the font rendering, which is _objectively_ crap.

      I suspect that the algorithms were developed for CRTs, where they might have worked, due to CRTs blurring. On an LCD, however, they are horrid.

      If you are on a Mac, look up now are your File menu. Notice the F has a grey bar under the top horizontal stroke. Move back, notice that the stroke now looks out of focus.

      Move back to where you can't reach the keyboard. Hey! Now it looks good.

      Damn, I'd finally trained myself to ignore it. Now it's bugging me again.

    38. Re:HA! by amorsen · · Score: 1

      The default font rendering on e.g. Fedora from the last couple of years is superior to the Windows renderer, both in beauty and in legibility, as long as you're on an LCD display (and who isn't, these days?)

      I can set the text in gnome-terminal to 4.5pt and it's still readable. The text in this input box in Firefox is clear and without colour fringes. The letters aren't distorted and the spacing is even (unlike the Windows rendering).

      --
      Finally! A year of moderation! Ready for 2019?
    39. Re:HA! by Anonymous Coward · · Score: 0

      And I'm pretty sure you're wrong. Sorry. You might choose to measure font rendering that way--fidelity at any cost, even if it means reducing text to illegible blobs

      Illegible blobs are produced on no modern system. You are attacking a straw man.

      In such cases, making "click here" distinguishable from "dick here" is more important than preserving the font designer's artistic vision.

      And because of the TrueType alignment and kerning liberties, you're more likely to end up with "dick here" when the design of the typeface is compromised.

      Again, this is only true if you ignore what happens at small sizes.

      And again, this is only true if you apply subpixel rendering at these small sizes. Both Apple and Microsoft systems do not.

      Nope, you've got it backwards: Microsoft's approach involves more fine-tuning. Apple's approach is easier to implement: just scale the outline to the appropriate size and fill it in.

      A puzzling and inaccurate description that describes both the Microsoft and Apple approaches. The question is method of scaling. Apple's methodology looks at pixel boundaries and typeface parameters. Link.

      Nonsense. A font that looks fine when rendered in a 15-pixel-high line (on a 300 DPI printer) may look illegible when rendered unchanged in a 5-pixel-high line (on screen). That doesn't mean the typeface is poor, it just means it's too intricate for such a low resolution.

      In other words, as I said the first time, it's a poor typeface selection.

      You seem to be confused about how that renderer works. It's far from "simplistic snap-to-grid": simply snapping the font's vertices to a pixel grid would produce garbage. What it actually does is apply the TrueType hints found in the font file.

      No, I'm afraid that's exactly backwards. TrueType, including its hinting, was in fact developed by Apple. Hinting was unique to Apple systems long before subpixel rendering. Microsoft eventually began using the hints, but this information isn't about subpixel rendering. It's about pixel-level placement.

      No, not in every way; only in the particular way you've chosen to focus on. Your personal, subjective preference is showing.

      My personal, subjective preference was never hidden.

      But that has no bearing on what is objectively true: the typeface is better preserved on Apple systems. There's no objective analysis that makes Microsoft's system better in any way. That's simple fact.

      The two systems are a wash in legibility. Apple's maintains the technical fidelity that is critical. It's not controversial in the least among anyone actually versed in the field.

      You, however, are not. Based on your comment history, you have a habit of getting into arguments here and presenting yourself as an authority, and yet never provide any substantive support.

    40. Re:HA! by Anonymous Coward · · Score: 0

      Viewing a photo is very very different from reading text. In fact, I find it completely preposterous that anyone would regard the two things as having anything in common.

      Because you have no idea what goes into typeface design.

      The two are extremely similar. Both are careful representations prepared by highly trained and skilled experts for presentation in media. They are carefully constructed for legibility (both clarity and flow) and painstakingly crafted on aesthetic and scientific levels.

      It is exactly the same as photographic presentation. A photographer captures an image, using deliberate camera settings, color space, and camera or CCD selection. When that image is manipulated on a computer screen, it is essential that the photographer have as much fidelity as physically possible. When printing that image on paper, it is also essential that proper calibration and display be possible.

      You need to understand that text on a computer screen is not always intended for publication on a printed page.

      No, you need to understand that typeface presentation should always be true to the typeface.

      The on screen representation should always be true to the reference presentation, and print preview should always be accurate.

      Ironically, text rendering is the one issue that is different from all of the above. Text is a discrete medium: a letter is either an a, b, or c, or so on. Photos, sound, and video are analog media, perceived along a continuum by the human brain. Text fidelity means only one thing: being able to tell letters apart.

      Absolutely false. There are hundreds of major typefaces, and fidelity means being able to render the differences between them.

      What you describe as "text fidelity" is nothing of the sort. It is merely character distinctiveness.

      In reality, there is no difference between typeface design and graphics design. For someone like you, who insists that the only function of a typeface is character distinctiveness, to engage in such a far-reaching condemnation of a field he doesn't even begin to understand is foolish at best.

      One might say that the only job of a programmer is to feed numbers to a calculator. There's no creativity, no efficiency, no art, no individual character, no meaningful difference between one program and another that does the same thing.

      Anyone (such as you) who thinks font accuracy is worthy as an end in itself is clearly living in a different world from someone (such as me) who reads scientific papers (the vast majority of them on-screen, simply because carrying around 1GB worth of printed papers is impossible) and writes code for a living.

      Font accuracy is what preserves legibility. Typefaces are painstakingly crafted.

      why do you insist that the two must always match, or that they must even try to match?

      Why do you excuse inaccuracy? They must match for the simple reason that it is accurate. Does it not matter to you if a compiler takes some liberties for the sake of efficiency, deciding to present results other than what you intended if 98% of your users wouldn't care or notice the difference?

      You don't care if it looks like the creator intended? Fine. Why do you insist that the system should be excused from functioning properly because you lack the technical expertise to notice or the personal interest to care?

      Computer source code is never meant to be printed or "published" on paper. There's no reason to display it on a monitor using the same font shapes as on printed pages.

      There are thousands of reasons.

      Your harangue misses the point entirely: if you are working primarily on a medium for purely digital use, you should select a typeface designed for that medium. Microsoft commissioned a family of fonts for exactly that purpose on Wi

    41. Re:HA! by Mr2001 · · Score: 1

      And again, this is only true if you apply subpixel rendering at these small sizes. Both Apple and Microsoft systems do not.

      Subpixel rendering has nothing to do with it. Without subpixel rendering, you'll just get a monochrome blob instead of a fringey greyish blob. In order to get a legible character at very low resolutions, you have to distort the outline.

      In other words, as I said the first time, it's a poor typeface selection.

      Nope. If you're designing something that will eventually be printed (or otherwise rendered at high resolution), you ought to choose a typeface that will look good on paper. If that typeface then looks illegible at low resolutions on screen, you ought to use an algorithm that makes it legible (unless you absolutely need to see correct outlines and kerning while you're editing).

      You seem to be suggesting that if your preferred print typeface looks bad on screen, you ought to compromise your selection of print fonts in order to make the text more legible on screen. You're not really the same AC who claimed to work in the print industry, are you?

      No, I'm afraid that's exactly backwards. TrueType, including its hinting, was in fact developed by Apple. Hinting was unique to Apple systems long before subpixel rendering.

      No, I'm afraid it's correct. TrueType's origins 20 years ago have no bearing on the fact that today, OS X ignores hints that Windows follows. Perhaps that's because Apple feels advances in monitor technology have made hinting less important, or perhaps it's just a stylistic choice to preserve the outlines - I don't know Apple's motivation.

      But that has no bearing on what is objectively true: the typeface is better preserved on Apple systems. There's no objective analysis that makes Microsoft's system better in any way. That's simple fact.

      No, sorry. In fact, since OS X ignores the hints that the font designer explicitly added to support low-resolution rendering, one could argue that Windows is truer to the designer's intent. A font is more than just a set of outlines.

      It's not controversial in the least among anyone actually versed in the field.

      The inaccurate statements you've made about the two renderers suggest that you aren't versed in the field.

      Based on your comment history, you have a habit of getting into arguments here and presenting yourself as an authority, and yet never provide any substantive support.

      If you'd like citations for any factual claims I've made, ask and I'll be happy to provide them. That's another one of my habits you may have noticed.

      --
      Visual IRC: Fast. Powerful. Free.
    42. Re:HA! by mr_matticus · · Score: 1

      The difference between images/gamma and fonts/fidelity is pretty simple. With images, in general the single goal is an accurate representation of the image on your viewing device. This is because the purpose of the image is to be looked at.

      I've seen this argument creep up a lot on Slashdot, and I think it captures in a nutshell the programmer's mindset, and a main cause of the singular inferiority of Linux typefaces and font rendering. With the Microsoft-Apple rendering debate, at least both companies have some understanding of typefaces beyond the sentiment expressed here.

      First, let's be clear, since this discussion is pretty muddled. A typeface is not a font. Fonts are merely matched sets within a typeface. A font is rendered from a typeface based on user settings, but it's the typeface that is the work of design. Helvetica is a typeface, not a font.

      With fonts, fidelity is NOT the single goal since the font itself serves a further purpose: it encodes a text, which's purpose is to be read.

      There is no purpose to a multi-typeface environment if the purpose is merely to encode text. Every computer would simply have one typeface designed around screen display, and convert all text to that typeface.

      Of the tens of thousands of typefaces, only a few hundred are meant to be used for encoding lengthy texts. But ALL of them are meant to be displayed as designed, regardless of medium.

      So the primary goal of a font is to be legible. Being true to the font designers idea is secondary.

      Strike that; reverse it. A typeface and its constituent fonts are first and most works of art. IF it is being used for the purpose of documenting a lengthy text (for which most typefaces are not designed), then an appropriate typeface should be selected for the environment, including the display medium and other factors.

      People have designed exquisite typefaces for text on print media. Others have done the same for screen presentation. Most typefaces are not meant to produce razor-sharp text at impossible tiny sizes on computer screens. Forcing them to is like having your file browser artificially sharpen soft-focus photos when it detects them.

      It is reasonable to expect that selecting a typeface actually shows that typeface accurately. What is the point of showing it at all if you're not going to present it accurately as designed? You should simply change the typeface to one more suitable for screen use, rather than butchering the design, which makes the typeface displayed not the one that was selected.

      Microsoft led the push to adopt its web fonts to attempt to get people away from using print media typefaces on their websites, which I think is the right idea. The fundamental flaw in Windows, OS X, and Linux typeface management is that it makes the assumption that users know how to select suitable typefaces. They don't. Organization by category (Print, Text, Icon/Mark, Screen, Web-safe) would be massively helpful here.

      Some people take the same utilitarian approach to photography--its function to them is just to document scenes and events. But it too is first and foremost an artistic composition, even if the ultimate use is simply to document, and a computer display should do exactly that, without editorialization. If your terminal typefaces are too blurry, you're using the wrong typeface.

    43. Re:HA! by serviscope_minor · · Score: 1

      Change the image scale in View->HTML options. Use 50% or 25% as suggested by the article.

      As one might expect, the result is perfect.

      --
      SJW n. One who posts facts.
    44. Re:HA! by David+Jao · · Score: 1

      if you are working primarily on a medium for purely digital use, you should select a typeface designed for that medium. Microsoft commissioned a family of fonts for exactly that purpose on Windows systems.

      Yes, this is totally 100% true, and Verdana is one of those fonts that was designed for purely digital use.

      Microsoft's font rendering system made screen-fonts worse, which is why they created Verdana.

      Excuse me? Up above you said that in the context of digital use, you should select a typeface designed for that medium. But then you proceed to criticize Microsoft for doing exactly what you recommend, namely creating and using Verdana. Your argument contains no logical validity whatsoever. It is self-contradictory.

      If you were to print out Microsoft's rendered fonts in a novel, people would demand a reprint by the publisher.

      This is from a previous post of yours, but I couldn't resist pointing out the additional contradiction. Microsoft's font rendering is designed for purely digital use. It's ridiculous for you, or anyone, to even suggest printing out a novel in a Microsoft font that is rendered for digital use. I can't tell exactly what you're trying to say, since there are so many contradictions in your statements, but it should be clear that a font designed for computer displays is not appropriate for use in printed matter, and that a font designed for printed matter is not appropriate for use on a computer screen.

      The on screen representation should always be true to the reference presentation, and print preview should always be accurate.

      Print preview is one of the very few situations where font rendering accuracy is desirable, because you're trying to print something out. However, it is not true in general that you're always trying to print something out. For you to say otherwise is nothing more than a reflection of your bias as a publisher.

      Font accuracy is what preserves legibility. Typefaces are painstakingly crafted.

      A typeface which is painstakingly crafted for print media is not going to look good on a computer screen. If you think it is possible for any single font to be simultaneously appropriate for paper use and monitor use, then you are, for lack of a better word, blind.

      Typefaces such as Verdana, which are crafted specifically for digital displays, are an exception. In such cases, I completely agree that font accuracy on a computer screen is important, because the font was designed for monitors. But then, I find it perplexing beyond belief that you would criticize Microsoft for creating a font specifically designed for computer displays, or that you would complain about such a font on the grounds that a novel printed in it wouldn't look good.

      Because you have no idea what goes into typeface design.

      If your idea of what goes into typeface design is that fonts in print must match fonts on computer displays as accurately as possible, then I don't want to have anything to do with your notion of typeface design.

      Do you get it yet? I am not like you. When I read a block of text on a computer screen, with very rare exceptions (such as print preview), it is not important to me whether the fonts have the same shape as what the printer produces. What is important to me is whether the text is clear. The clearest shape for computer displays is not the same as the clearest shape for paper printouts. Therefore, I don't mind using different shapes for the two situations. This is the correct tradeoff in my situation. It is less correct, but more usable. As one of many possible valid tradeoffs, it cannot be described as better or worse than any other choice, and there's certainly no objective measuring stick in such a situation.

      To go even further, I don't even care if my computer mo

    45. Re:HA! by Anonymous Coward · · Score: 0

      Subpixel rendering has nothing to do with it. Without subpixel rendering, you'll just get a monochrome blob instead of a fringey greyish blob.

      No, subpixel rendering methodologies are the key difference in Microsoft and Apple anti-aliasing methods. The article you originally provided demonstrates rendering differences in the subpixel algorithms. The pixel-level rendering is almost identical.

      If you'd like citations for any factual claims I've made, ask and I'll be happy to provide them. That's another one of my habits you may have noticed.

      Provide them. Start with legibility studies. Next, a source that demonstrates that OS X "ignores" TrueType hints that Apple created in the first place. Then a source showing Microsoft offers higher technical fidelity in any aspect. Then, show that the Microsoft rendering engine is anything more than a closest-fit grid snap. You can then provide a counter source to the one already given to you to show that Apple's font rendering engine has no perceptual nuance and ignores pixel boundaries.

      If that typeface then looks illegible at low resolutions on screen, you ought to use an algorithm that makes it legible (unless you absolutely need to see correct outlines and kerning while you're editing).

      Absolute nonsense. If you're designing for print, you should never use an algorithm that shows different character placement and properties. If it's illegible at low resolutions on screen, increase the resolution or zoom in your document editor. You don't need on-screen legibility at tiny sizes if you're designing for print.

      You seem to be suggesting that if your preferred print typeface looks bad on screen, you ought to compromise your selection of print fonts in order to make the text more legible on screen.

      If your preferred print typeface looks bad on screen, who cares? Print prep should be true to print format at all times. If you're working on a print document at 1/6 size, small text may not be legible. It's irrelevant. Zoom in. Selection of typeface for print is not constrained by legibility on screen. The idea is absurd.

      The inaccurate statements you've made about the two renderers suggest that you aren't versed in the field.

      You've yet to demonstrate a single inaccuracy.

    46. Re:HA! by Mr2001 · · Score: 1

      No, subpixel rendering methodologies are the key difference in Microsoft and Apple anti-aliasing methods. The article you originally provided demonstrates rendering differences in the subpixel algorithms. The pixel-level rendering is almost identical.

      Uh-huh. I suppose that's why the line of Mac text is 14 pixels wider than the line of Windows text? "Almost" indeed.

      Provide them. Start with legibility studies.

      I'll do even better: here's a side-by-side comparison. That's OS X's Helvetica on top, Windows 7's Arial on bottom, both at 5 pixels high. As you can see, OS X does indeed turn off subpixel rendering at that size, but it doesn't help. Notice the letters running together. Also notice the inability to distinguish "t" from "f", "i", or "l"; "e" from "u", "o", and "s"; and "h" from "b".

      Next, a source that demonstrates that OS X "ignores" TrueType hints that Apple created in the first place. Then a source showing Microsoft offers higher technical fidelity in any aspect.

      "Font hinting is the method preferred by Microsoft. Unhinted font is used on OS X and Linux."
      "without any hints or grid-fitting but with subpixel accuracy (similar to rendering in Mac OS X)"
      "I recently spoke with a renowned font designer, and he complained that Apple ignores the hinting he (and other designers) specifically puts into his fonts."
      "Apple's rendering approach on Mac OS X ignores almost all the hints in a TrueType font"

      Admittedly, these are claims about Apple's renderer, not source code snippets from the renderer itself. Perhaps everyone is wrong. Do you have a better source demonstrating that Apple does respect the hints?

      Then, show that the Microsoft rendering engine is anything more than a closest-fit grid snap.

      A moment's thought should illustrate why a "closest-fit grid snap" would not produce anything looking remotely legible, but in case that isn't enough, here's Microsoft's overview of their rasterizer's operation, which includes: "Adjusting the outline description to the pixel grid (based on hinting information)."

      If you're designing for print, you should never use an algorithm that shows different character placement and properties. If it's illegible at low resolutions on screen, increase the resolution or zoom in your document editor. You don't need on-screen legibility at tiny sizes if you're designing for print.

      As I explained in my original post in this thread, that's fine for work such as graphic design where those details matter, but the average office worker writing a letter or spreadsheet cares more about reading the text than matching the printed page pixel-for-pixel. Newsflash: not everyone works in the same industry as you.

      You've yet to demonstrate a single inaccuracy.

      I've got to hand it to you: your powers of denial are impressive. Subpixel rendering? Snap-to-grid? Yes, you're batting a thousand, all right.

      --
      Visual IRC: Fast. Powerful. Free.
    47. Re:HA! by Anonymous Coward · · Score: 0

      Excuse me? Up above you said that in the context of digital use, you should select a typeface designed for that medium. But then you proceed to criticize Microsoft for doing exactly what you recommend, namely creating and using Verdana. Your argument contains no logical validity whatsoever. It is self-contradictory.

      No, the criticism is that Verdana is a face designed for use on Windows. It is designed around ClearType because ClearType does not respect TrueType typefaces that were already designed for screen media use. Verdana is not a cross-platform screen typeface. It's a band-aid to fix what shouldn't need fixing. Had Microsoft just respected the rendering profiles of existing typefaces designed for screen use, it wouldn't be necessary.

      However, because ClearType actually alters and worsens those TT faces meant for screen use, they had to go and commission a new set for ClearType, not for "digital use" generally as you imply.

      Microsoft's font rendering is designed for purely digital use. It's ridiculous for you, or anyone, to even suggest printing out a novel in a Microsoft font that is rendered for digital use

      Microsoft's font rendering is not designed for purely digital use. Font rendering, as the name should imply to you but apparently does not, is meant to render the font. That is true of print preparation and screen presentation.

      A typeface which is painstakingly crafted for print media is not going to look good on a computer screen. If you think it is possible for any single font to be simultaneously appropriate for paper use and monitor use, then you are, for lack of a better word, blind.

      This is my point entirely. Why is Microsoft taking liberties with the typeface design? Why do they strive to make print faces "sharper" for display on a computer? Why do they meddle with TrueType fonts that were designed for screen media, breaking them and requiring a third pass (Verdana)?

      What is important to me is whether the text is clear. The clearest shape for computer displays is not the same as the clearest shape for paper printouts. Therefore, I don't mind using different shapes for the two situations. This is the correct tradeoff in my situation. It is less correct, but more usable

      Which begs the question entirely; it's a circular point. Why are you using print typefaces for screen media work? The clearest shape would be a typeface designed for screen use and faithfully rendered. It is not a print face passed through an inaccurate, unfaithful, arbitrary "sharpening" process.

      It just so happens that Verdana and a handful of other Microsoft-commissioned fonts are specifically designed with the rendering defects in mind to produce the intended result despite rendering infidelity. A designer should not have to design around a renderer; the renderer should present the designer's intent.

      To go even further, I don't even care if my computer monitor shows me a completely different font from what my printer produces.

      This is idiotic. You're comfortable with a problem that shouldn't exist in the first place. You should be using a completely different typeface if this is the case.

      The most highly readable monitor font is not going to be the same as the most highly readable print font. Even you agree with this statement: "if you are working primarily on a medium for purely digital use, you should select a typeface designed for that medium."

      Indeed.

      Use the same font on both paper and monitors, with the exact same rendering (within the physical limits of the medium). This is what you recommend, but as the previous paragraph explains, it is absolutely impossible to attain optimal readability in both media with the exact same rendering.

      Optimal readability is a

    48. Re:HA! by Anonymous Coward · · Score: 0

      Uh-huh. I suppose that's why the line of Mac text is 14 pixels wider than the line of Windows text? "Almost" indeed.

      I beg your pardon? The image of the Mac's rendition is 168 pixels across, and the Windows version measures 164 pixels across, a difference of 4 pixels, or about 2%. Almost, indeed.

      I'll do even better: here's a side-by-side comparison. That's OS X's Helvetica on top, Windows 7's Arial on bottom, both at 5 pixels high.

      You're a snake. Helvetica and Arial are not the same typeface, nor does anyone actually work with 5px lines of text.

      "Font hinting is the method preferred by Microsoft. Unhinted font is used on OS X and Linux."
      "without any hints or grid-fitting but with subpixel accuracy (similar to rendering in Mac OS X)"
      "I recently spoke with a renowned font designer, and he complained that Apple ignores the hinting he (and other designers) specifically puts into his fonts."
      "Apple's rendering approach on Mac OS X ignores almost all the hints in a TrueType font"

      These are all uncited sources, and all of them clearly show in context that they're using "hinting" as a stand-in for grid-fitting. It's a common shorthand, but a substantively inaccurate statement, which you might have recognized had you been familiar with the field of typography before you planted yourself firmly in a land of ignorance.

      Hinting, contains a , all of it used by OS X, since without it, the screen version would not approximate the printed version. Hinting, a reverse metonym for grid-fitting and TrueType hint data are two separate concepts you've continually conflated, likely out of ignorance but possibly out of dishonesty.

      Finally, consider this source provided by you that directly contradicts your point: http://zajac.ca/fonts/ -- observe the three way comparison between FontFocus, UNHINTED, and OS X rendering. Note that OS X and unhinted rendering are not even close to identical.

      A moment's thought should illustrate why a "closest-fit grid snap" would not produce anything looking remotely legible, but in case that isn't enough

      Actually, as Microsoft clearly shows, its honoring of the grid integrity is the intent of its ClearType algorithms. "Modifying an outline in this manner is known as grid-fit."

      the average office worker writing a letter or spreadsheet cares more about reading the text than matching the printed page pixel-for-pixel. Newsflash: not everyone works in the same industry as you.

      Logic flash: use a screen face for that.

      I've got to hand it to you: your powers of denial are impressive. Subpixel rendering? Snap-to-grid? Yes, you're batting a thousand, all right.

      Actually, you might have learned something and stopped the foot-mouth syndrome had you stopped to think instead of rushing to argue.

      Microsoft's system does not produce text that is more legible at working sizes. I notice you presented nothing to substantiate that claim except a hilariously irrelevant and patently dishonest "side by side" showing different faces at different weights at a size no one uses for work. I do give you points for including a source clearly asserting superior legibility in OS X, though.

      I make no such claim. Legibility is a wash between the two in my opinion. But technical accuracy is clearly and unequivocally in Apple's court.

    49. Re:HA! by Mr2001 · · Score: 1

      The image of the Mac's rendition is 168 pixels across, and the Windows version measures 164 pixels across, a difference of 4 pixels, or about 2%.

      Now that I measure it again, I see you're right. My mistake.

      Helvetica and Arial are not the same typeface

      And the relevant difference in this case is... the designer of Helvetica wanted to produce illegible blobs at low resolutions?

      But you do have a point there, so here's a fairer comparison: OS X (top) vs Windows 7 (bottom) rendering Arial at 5px. I'd hardly call that an improvement.

      nor does anyone actually work with 5px lines of text.

      And yet for some reason, font designers still bother to specify hints for those sizes, and OS programmers still bother to implement algorithms that make the text legible at those sizes. Hmm. Perhaps your generalization is wrong? Perhaps some people like to zoom out so a line of text is only a few pixels high and still be able to read it? Nah, that couldn't be it, everyone does exactly the same sort of work that you do and in exactly the same fashion.

      Finally, consider this source provided by you that directly contradicts your point: http://zajac.ca/fonts/ -- observe the three way comparison between FontFocus, UNHINTED, and OS X rendering. Note that OS X and unhinted rendering are not even close to identical.

      Actually, they're pretty close. OS X's rendering is wider and the letters have the same appearance at different places in the text, so it's clear that OS X is doing something, but it's not clear what that is: there doesn't seem to be any change within each character outline, only in the (fractional pixel) spacing between characters.

      Actually, as Microsoft clearly shows, its honoring of the grid integrity is the intent of its ClearType algorithms.

      Yes, of course it is.

      That doesn't mean their algorithm consists of a simple "closest-fit grid snap" as you've repeatedly claimed, though: a naive algorithm like that would be unable to produce dramatic changes like the "N" illustrated here. Perhaps you're confused by their use of the term "grid-fit" to refer to the entire process of aligning and distorting the character outline before filling it in.

      Logic flash: use a screen face for that.

      So, use one font while you write a letter and another when you print it? Talk about loss of fidelity!

      Microsoft's system does not produce text that is more legible at working sizes. I notice you presented nothing to substantiate that claim

      That's because it's Microsoft's claim, not mine.

      But technical accuracy is clearly and unequivocally in Apple's court.

      If preserving the high-resolution character outlines is your sole measure of technical accuracy, then I suppose so.

      --
      Visual IRC: Fast. Powerful. Free.
    50. Re:HA! by moonbender · · Score: 1

      There is no purpose to a multi-typeface environment if the purpose is merely to encode text.

      That is not what I said. I said the primary goal is encoding text; I never said it's the only goal. This multi-faceted character was the whole point of the comparison with images.

      So the primary goal of a font is to be legible. Being true to the font designers idea is secondary.

      Strike that; reverse it. IF it is being used for the purpose of documenting a lengthy text (for which most typefaces are not designed), then an appropriate typeface should be selected for the environment, including the display medium and other factors.

      Well, not sure where to start. Well first of all now you silently seem to concede that legibility and fidelity are at odds in certain situations. That was really the central point I was making in my previous post so I could just stop here.

      I'll add that it's a given that we're talking about fonts^Wtypefaces that are designed for either lengthy texts or something similar that's fairly specific to computer interfaces. Text at a standard print size is, after all, one of the central elements of the GUI (and the only element in non-G UI). Talking about fonts designed for other purposes and legibility and rendering at larger sizes means missing the point. I agree that designing and using fonts well-suited to the relatively low-ppi display technology is a very good idea. And of course I look forward to having super high resolution displays in the forseeable future.

      --
      Switch back to Slashdot's D1 system.
    51. Re:HA! by moonbender · · Score: 1

      Damn it, Slashdot ate my italics, the paragraph below the blockquote is another quote, so it should be:

      So the primary goal of a font is to be legible. Being true to the font designers idea is secondary.

      Strike that; reverse it. IF it is being used for the purpose of documenting a lengthy text (for which most typefaces are not designed), then an appropriate typeface should be selected for the environment, including the display medium and other factors.

      (Rest of my comment.)

      --
      Switch back to Slashdot's D1 system.
    52. Re:HA! by David+Jao · · Score: 1

      No, the criticism is that Verdana is a face designed for use on Windows. It is designed around ClearType

      Check your facts. Verdana was released in 1996. ClearType was announced in 1998 and released in 2000. The earliest patent issued for ClearType was filed in October 1998. There is no way Verdana could have been designed for ClearType.

      The rest of your post is complete nonsense since your facts are wrong.

    53. Re:HA! by Anonymous Coward · · Score: 0

      But you do have a point there, so here's a fairer comparison: OS X (top) vs Windows 7 (bottom) rendering Arial at 5px. I'd hardly call that an improvement.

      And again, I wouldn't call the bottom line legible or workable text in any scenario. No one works with 5px text...ever. That's a font size of less than 4 points. There's no situation, print or screen, where legibility at 5px is an actual usability factor. It's a contrived and artificial comparison that highlights exactly what one would expect: by grid-fitting you strip away data and ignore weight hints.

      Put to you another way, is clarity at microscopic and unworkable sizes worth inaccuracy with no definitive gain in legibility at sizes people actually use to read?

      That's even assuming you've crafted a fair comparison, which is by no means a foregone conclusion, given your lack of attention to detail or outright dishonesty previously. You've shown no methodology and stored the image in such a way as to destroy the font data so that it can't even be compared upon magnification. You've not specified the source, provided any verification of the face and weight settings, or even demonstrated which renderer was used.

      Perhaps some people like to zoom out so a line of text is only a few pixels high and still be able to read it?

      Provide a usage scenario for that. One in which the person would actually work with 5px text to perform copy editing or would sit through and read it.

      And yet for some reason, font designers still bother to specify hints for those sizes

      Actually, at that size, ClearType succeeds only at character distinction. Essentially all sans-serif faces and all serifed ones render identically. Color, weight, symmetry, alignment, spacing, all ignored because the letters are stuffed in a 5x4 pixel grid at that size.

      But as above, character distinction only matters if people are actually going to be reading those 5px characters on the screen. And there is no reason why they would. Either the text tool has a separate input for text editing before rasterization, which is displayed in a system face, or the document editor will zoom to a comfortable level. The only reason that text would ever be presented that small on screen is for layout purposes, which obviously would require that accurate representation be prioritized over readability at 1/5 size or smaller.

      Actually, they're pretty close. OS X's rendering is wider and the letters have the same appearance at different places in the text, so it's clear that OS X is doing something, but it's not clear what that is: there doesn't seem to be any change within each character outline, only in the (fractional pixel) spacing between characters.

      Again, I beg your pardon? The middle text has distinctly different outlines than the first and third method. It's the first and third that have identical outline. For what it's worth, FontFocus preserved the character outline, identical to Apple rendering, but aligns all stems to pixel boundaries by shifting the characters by fractions of a pixel so that they line up. The result is accurate rendition of form (because the character form is preserved and only shifted horizontally, not altered into a grid fit), but not of space (because of the horizontal shifting). That method is actually a fairly effective compromise, since accuracy of space stops being a problem at larger sizes for verifying print alignment and except for very picky layout editors, being off by a fraction of a pixel is usually tolerable. Unfortunately, FontFocus didn't end up quite working properly, but it remains a good proof of concept.

      That doesn't mean their algorithm consists of a simple "closest-fit grid snap" as you've repeatedly claimed, though: a naive algorithm like that would be unable to produce dramatic changes like the "N" illustrated here.

      Actually, that's exactly the

    54. Re:HA! by Anonymous Coward · · Score: 0

      Excuse me, you're right. I was incorrect to lump Verdana in with the ClearType fonts. Substitute Verdana with Calibri and Segoe or any of the other ClearType faces.

      The post is not complete nonsense--just the face name. My apologies.

    55. Re:HA! by Anonymous Coward · · Score: 0

      Family name mistake aside, though, your dismissal seems to ignore the bulk of the post, which has nothing at all to do with Verdana. I take it you have no response, since you took a mistake of name as an opportunity for handwaving dismissal and your pulling up of facts would have easily revealed the ClearType font collection I was speaking about.

      So in other words, you obviously knew what was intended and went for smartass instead of reason. Remaining questions abound: you claim to use Linux, but also Verdana, a patented font. Are we to assume you are lying as well? I gave you the benefit of the doubt, that you may have simply sought out and installed Verdana. Apparently you are unwilling to do the same. Easier to back out of discussions that way.

    56. Re:HA! by Mr2001 · · Score: 2, Informative

      By now it's clear that you have no interest or understanding of any application of digital text other than what you've encountered in your own limited experience, and that you lack the technical knowledge to evaluate or discuss the workings of any font rendering algorithm.

      Between your ignorance, your accusations, your nonsensical demands (don't use a bitmap image to demonstrate the renderer's output), and your elitist insistence that you are the sole arbiter of what a font renderer is supposed to aim for as well as how a person is supposed to edit documents (always zooming in rather than reading text at small sizes; choosing a print font based on what looks good on screen, rather than using software that makes their preferred print font legible on screen), I see no reason to continue this discussion. Have a nice day.

      --
      Visual IRC: Fast. Powerful. Free.
    57. Re:HA! by David+Jao · · Score: 1
      This discussion is well past the point of being useful. It's clear that you only care about fonts from your own point of view as a print publisher. I am not going to prolong the discussion just because you accuse me of backing out.

      I also find it curious that an anonymous coward would accuse me of backing out of a discussion. Only one of us is hiding his real name here.

      I will, however, refute your accusation that I am a liar. Verdana for Linux is legally available at zero monetary cost from http://corefonts.sourceforge.net/.

    58. Re:HA! by mr_matticus · · Score: 1

      Well, not sure where to start. Well first of all now you silently seem to concede that legibility and fidelity are at odds in certain situations

      "Now" as opposed to when?

      That is not what I said. I said the primary goal is encoding text; I never said it's the only goal. This multi-faceted character was the whole point of the comparison with images.

      The comparison, or more accurately, the contrast you propose, is faulty. Images sometimes encode visual information just as typefaces sometimes encode textual information. Both, however, are primarily artistic works, not utilitarian tools.

      The utilitarian treatment of typography by the technically-minded is exactly what I'm talking about.

      I'll add that it's a given that we're talking about fonts^Wtypefaces that are designed for either lengthy texts or something similar that's fairly specific to computer interfaces

      Except that it's not. Typefaces that are designed for lengthy texts or computer interfaces are a tiny minority of the typefaces in existence--less than 1% of them, in fact.

      The point I'm making here is that your backwards view of the art and science of typography is emblematic of the greater problem of the state of typefaces and their presentation in Linux, and the general refusal to bring in actual experts in the field or address the obvious aesthetic shortcomings in KDE and Gnome. I happen to think both Microsoft and Apple do an excellent job and that Linux's biggest distinguishing character in the "desktop wars" is its woefully inferior typography.

      I'll say again, people have designed exquisite typefaces for text on print media. Others have done the same for screen presentation. Most typefaces are not meant to produce razor-sharp text at impossible tiny sizes on computer screens. Forcing them to is like having your file browser artificially sharpen soft-focus photos when it detects them, whether it's what the photographer wanted or not.

      The primary goal of a typeface is to express the creator's technical and aesthetic vision. The font renderer's only function is to present that vision, just like any other rendering engine. It's not to create highly legible on screen characters at screen resolution for every typeface; it's not to destroy the creation to make the typeface suitable for encoding long texts.

      If the user desires to read long texts on a low resolution screen, s/he should rely on typefaces designed for that purpose. The font renderer should not make assumptions about the purpose or intent of all uses, just as the graphics layer should not assume that all photos should be processed for maximum clinical accuracy. If you want to use the photograph as a diagram, take a suitable photograph. The artistically composed shot shouldn't be straightened, contrast tweaked, and sharpened by the rendering system when it wasn't asked to do so.

      If you've got problems with a blurry font, you're either using the wrong size for the resolution or the wrong typeface entirely. The change to be made in that case, though, is by the user, not by the renderer. If you don't care about accuracy, then you certainly can't care about the identity of the typeface.

    59. Re:HA! by moonbender · · Score: 1

      Okay, I think I get what you're saying. Fonts designed for the screen look good with an accurate renderer because they're designed for the screen. Other fonts might have other characteristics, but they're still accurate. Hm. I guess the latter part isn't essential to me, basically all the text rendered on my screen is rendered in fonts designed for computer displays. I take it you're of the opinion that Linux doesn't render those fonts correctly, either?

      --
      Switch back to Slashdot's D1 system.
  8. Nitpicking by Ekuryua · · Score: 1, Insightful

    Is what this article is about.
    This matter has been known for a long time, and there's a reason why so many softwares ignore it:
    it hardly matters. That and it's also way more complicated to do it properly.
    Gain / Pain is clearly inferior to 1 there.

    1. Re:Nitpicking by caseih · · Score: 2, Insightful

      But the point of the article is that it is possible to do it correctly. As many posts have pointed out, the standard gamma for sRGB images where the gamma is not specified is 2.2. Not taking that into account is, in fact, an error. If the image data are not linear to begin with, then why are we applying algorithms to the image as if they were?

      Changing the image's gamma value during scaling is an error, plain and simple, especially when we know what the gamma of the image is to begin with!

      Programs like Picasa and other photography programs certainly should be taking this into account.

      Most professional photographers capture all their images to raw format. I think raw images are linear and are mapped to a gamma in post-production. So they probably will be less affected by this error. This may be why the pain/gain ratio for Adobe, for example, would be too large.

    2. Re:Nitpicking by jabberw0k · · Score: 1, Informative

      so many softwares

      Urrgh... it's "so many programs" or "so many software packages" ... you don't have "one software" -- you have a piece of software. It's a collective noun like "hardware" and "clothing." There is no word, "softwares."

    3. Re:Nitpicking by Anonymous Coward · · Score: 0

      But at least now I know there was some actual reason for why I had to sharpen pics when making my thumbnail images, it wasn't just because I thought it looked off. Contrast really is lost with the standard scaling/resizing routine. Having an alternate method that evaluates the image histogram and correctly adjusts some factors before/during scaling based on that would be nice to have. (Apparently this is what the author is demonstrating.) Now the question is how soon until we can get the plugins to download for our image manipulating software(s)?

    4. Re:Nitpicking by Anonymous Coward · · Score: 0

      Correct, we have known this for a long time. If desired, it can be fixed, but that does make the scaling slower and for most images, where the colour differences between neighbouring pixels are low, there is no visible difference. The tuned image that he used is very uncharacteristic for real life imagery.
      Still, I suppose it would be need to get it fixed in ImageMagick. And the situation is yet another reminder that you shouldn't store scaled images. Store the original, and let the software scale it on the fly when you need it. That way you'll get the benefit of future improved scaling algorithms automatically.

    5. Re:Nitpicking by im_thatoneguy · · Score: 2, Interesting

      It's not at all complicated. Many applications do properly handle it. Nuke, Shake and other compositing apps have no problem.

      Pixel^(GAMMA) -> Scale -> Pixel^(1/GAMMA) I wouldn't call that a terribly complicated process.

      Or even better. On open convert it to linear. Then on save convert it back. Maybe then Photoshop and company would actually handle alpha channels correctly *grumble* *grumble*...

    6. Re:Nitpicking by Zaphod+The+42nd · · Score: 1

      And all the bugs they have instead! :D

      --
      GCS/MU/P d- s:- a-- C++++$ UL++ P+ L++ E+ W++ N o K- w--- O M+ V- PS+++ PE Y+ PGP t+ 5- X R++ tv+ b++ DI++ D++ G+ e++ h-
  9. I look better in person. by ipquickly · · Score: 5, Funny

    I've been telling people for years that I look better in person.
    I told them that there's something wrong with pictures of me.

    HA!

    Now I know.

    It's the Scaling Algorithm BUG!

    1. Re:I look better in person. by grcumb · · Score: 2, Funny

      It's the Scaling Algorithm BUG!

      Man you gotta come up with a better line than that. Even 'I just went swimming', or 'It's cold in here' is more convincing than that!

      In any case, your girlfriend will still be disappointed....

      ... If you ever get one.

      --
      Crumb's Corollary: Never bring a knife to a bun fight.
    2. Re:I look better in person. by Anonymous Coward · · Score: 0

      I have the same problem with pictures of your mom.

      The scaling required to make them fit on my screen is simply, well...

  10. A great demo... by Interoperable · · Score: 1

    for people with poor quality displays!

    I now have a much better understanding of why I have to constantly adjust the angle of my (laptop) monitor every time I move my head. Some of the demos on that page are great for illustrating the effect of a poor quality display (or poor scaling algorithm) on picture quality. I'll keep that page in mind the next time I shop for a laptop.

    --
    So if this is the future...where's my jet pack?
    1. Re:A great demo... by MortimerV · · Score: 4, Informative

      If you're looking for lcd test images, http://www.lagom.nl/lcd-test/ is probably better. It's got a whole bunch of images dedicated to various monitor problems, along with explanations.

  11. Not so common image by cbuosi · · Score: 1

    1) this image was created to reproduce the bug. except for low definition display (TV/NTSC) its not common to have this "scanlines". 2) instead of resising, just blur the image before and then resise. 3) Interesting bug, thou.

    1. Re:Not so common image by Anonymous Coward · · Score: 0

      2) instead of resising, just blur the image before and then resise.

      You'll find that blurring the image will cause it to turn almost completely gray.

    2. Re:Not so common image by Anonymous Coward · · Score: 0

      Unless, of course, you use a properly-gamma aware blur. But then... might as well just use a properly gamma-aware resize in the first place.

    3. Re:Not so common image by Machtyn · · Score: 1

      Using The GIMP, I used the standard blur, then resized 1:2. The result was similar to when I used the Sinc (Lanczos3) Interpolation method of resizing. I tried a bunch of the filters and most of them had interesting results of gray. The one exception was the different algorithms of Edge Detection. Sobel with a maximum amount found lots of edges. Gradient and Differential produced an image that did not appear to be interlaced.

    4. Re:Not so common image by im_thatoneguy · · Score: 1

      No but fine detail is common. The 'bug' causes an increase in moire effects.

    5. Re:Not so common image by kappa962 · · Score: 1

      Look at the article for more normal pictures, and how they generally become darker when they are scaled by algorithms with the bug.

      Also, the blurring algorithm seems just as likely to have this averaging bug as the scaling algorithm.

    6. Re:Not so common image by omnichad · · Score: 1

      These aren't scanlines. These are deliberate adjacent rows that are vastly different, for the purpose of exaggerating the problem. Even blurring (in Photoshop CS3) gives an almost completely gray image. The alternating rows are set up so that the red row + the green row = grey, unless you correct for gamma before you add them, in which case you get the intended colors.

  12. Oh dear. Linear color space again, 11 years later? by Animaether · · Score: 4, Insightful

    Come on, this isn't news...

    Helmut Dersch (of Panorama Tools fame) certainly posted about this before;
    http://www.all-in-one.ee/~dersch/gamma/gamma.html - Interpolation and Gamma Correction

    There's no factual error in the scaling algorithm, as the /. headline would like you to believe - it's a color space (linearity) issue; you have to do your calculations in linear space which means a typical photo off of a camera/scanner gets the inverse of an sRGB curve applied (a gamma of 0.454545 is 'close enough' if you can't do the proper color bits). Then scale. Then re-apply the curve.

    And no - for real life imagery, nobody really cares - the JPEGs out of the cameras and subsequent re-compression to JPEG after scaling will have 'destroyed' far more data than the linearity issue.

    They're nice example images in the story, but they should be called 'academic'.

  13. Some look worse. by Urza9814 · · Score: 1

    Is it just me or do some of the examples look _better_ with the "incorrect" scaling?

    For example, this one of the NASA image:
    http://www.4p8.com/eric.brasseur/gamma_21.html

    Look right at the center of that picture on the incorrect scaling one, and without moving your eyes switch it to correct. When I do it at least, it feels like my eyes instantly lose focus. With the incorrect scaling, everything looks perfectly crisp and clear. With the corrected one it takes a significant amount of effort to focus anywhere near the center of the image, and it takes significant effort to maintain that focus. The corrected one feels like I'm trying to look at a picture when I haven't put in my contacts yet...

    1. Re:Some look worse. by BoppreH · · Score: 2, Insightful

      That might be true, but it's no reason to turn this into an undocumented and unavoidable feature.

    2. Re:Some look worse. by PitaBred · · Score: 1

      Look at the islands and the lakes. They're crisp at the edges, whereas those islands disappear when you use the incorrect scaling. I wouldn't use the incorrectly scaled image for anything important.

  14. Gamma by friedo · · Score: 0

    As a programmer who knows nothing about graphics algorithms, can somebody explain to me exactly what gamma is? I've been told I should by worrying about it for at least a couple decades, but thus far my lack of knowledge has not caused by any bodily injury. Use small words.

    1. Re:Gamma by Yvan256 · · Score: 1

      All I know is that you actually need to remove any gamma information from a PNG file in order to display them correctly in most browsers. Otherwise, they're too dark on some configurations and too light on others.

    2. Re:Gamma by spitzak · · Score: 1

      This is because the gamma value that programs wrote to the png file is wrong.

      I think almost all software nowadays ignores png gamma values. I have gotten in some arguments with some color management folks because imho it works best to ignore *all* "color management" such as embedded profiles. They are wrong far more often than they are right, because the whole field is very confusing and software is filled with a zillion bugs.

      To answer the grandparent, the "gamma" is used to convert the numbers in the file into the actual brightness, the formula for brightness is pow(N/MAX, 1/GAMMA), where N = number in file, MAX = largest number file can store, and GAMMA = gamma value.

    3. Re:Gamma by Anonymous Coward · · Score: 0

      And then they still don't display correctly.

      That's why i'd use a gif for anything on a website that needed to blend into a coloured background.

    4. Re:Gamma by Anonymous Coward · · Score: 0

      IE6 supporter?

    5. Re:Gamma by uglyduckling · · Score: 1

      Well, I probably can't explain _exactly_ what it is. My understanding is that the human eye doesn't perceive brightness linearly, so gamma correction is used to logarithmically scale the values so that we can get more detail in the low-brightness regions. The upshot is that e.g. in 8-bit colour, a value of 128 in a given colour isn't perceived as half as bright as a value of 256, but as much darker. So an algorithm that just takes the mean of a given number of pixels in order to scale will generally produce much darker pictures than expected. A good compromise would be to take the root of the mean of the squares (i.e. a gamma of 2.0) because the commonest gamma is 2.2, and on older Macs it is 1.8.

    6. Re:Gamma by Anonymous Coward · · Score: 0

      This is because the gamma value that programs wrote to the png file is wrong.

      I think almost all software nowadays ignores png gamma values.

      No, it is mainly because Internet Explorer gets it wrong. They treat untagged images properly as sRGB but treat PNGs tagged with gamma==1/2.2 as if they had gamma==1/1.96. I don't know why.

      An approach that works is to use the PNG sRGB tag (which IE ignores and FireFox gets right) and delete the PNG gAMA tag (which IE gets wrong and Firefox gets right).

    7. Re:Gamma by spitzak · · Score: 1

      I would not only blame IE. The problem I saw was lots of png files marked with a gamma of 1.0 when in fact they had a gamma of 2.2, because of stupid software writers who said "hey I'm not raising this .gif file to any power, so it must mean the gamma is 1".

  15. Gamma and Computer Vision by drewm1980 · · Score: 3, Interesting

    Gamma is often poorly understood even by people doing scientific and engineering work using images.

    Does your algorithm depend (explicitly or implicitly) on the light intensity -> pixel data mapping?

    If NO: You're probably wrong. Go read about gamma. Just because the picture looks right to you, doesn't mean it looks right to your code.

    If YES:

    Do you have the luxury of taking the pictures yourself?

    If NO: You're stuffed. Pretty much all images on the internet and most public research databases have unknown/unreliable gamma curves.

    If YES:

    1. Spend a lot of time calibrating your camera yourself. This is only cheap if your time is worthless

    or

    2. Buy a machine vision camera. A $600 machine vision camera will have the specs of a $50 consumer camera, but at least you will know the gamma curve.

    or

    3. Ignore the gamma issue, cross your fingers, hope it's not hurting your performance, and publish your results knowing that you're in good company and nobody will call you out.

    1. Re:Gamma and Computer Vision by Anonymous Coward · · Score: 4, Interesting

      1. Spend a lot of time calibrating your camera yourself. This is only cheap if your time is worthless

      Typically this should be done during the initial set-up of any new camera that a photographer purchases. A Gretag Macbeth colour checker is cheap, the required shot to evaluate the performance of the sensor is quick and easy to set-up and the processing of this test image is fast with the right tools (like this script for photoshop). It should take under an hour to do it right and get it as part of the automatic stage of processing your RAW files (basically setting ACR/Lightroom's demosaicing stage), but the benefit is that every picture taken from then onwards does not need extra calibration. Thus your prints look like your shots, assuming the rest of your workflow is equally as calibrated.

      While your time is valuable, if you do not calibrate like this, you're wasting time further down the line for EACH image, and thus it's more expensive to not do it...

    2. Re:Gamma and Computer Vision by Anonymous Coward · · Score: 0

      We use (relatively) cheap Watec cameras and they all have a nice friendly switch which allows you to turn Gamma off. This makes it linear, although not `calibrated', and this is adequate for our work.

    3. Re:Gamma and Computer Vision by Anonymous Coward · · Score: 0

      Are you seriously telling me that calibrating a camera is more complex than taking a picture of a pantone card and running a program on the resulting image?

    4. Re:Gamma and Computer Vision by Twinbee · · Score: 1

      It seems to me that the gamma issue should be handled by the hardware behind the scenes. One shouldn't have to incorporate arcane number spaces in software, when a perfectly simple linear system should do the job.

      Thus we should fix the real problem, and make the hardware (or at the very least, the OS abtraction layer) conform.

      Does this post make sense?

      --
      Why OpalCalc is the best Windows calc
    5. Re:Gamma and Computer Vision by drewm1980 · · Score: 2, Insightful

      I was talking about scientific and engineering uses, which often depend on the gamma curve even if most authors ignore it.

      Most photographic software is oriented towards deliberately messing with the gamma curves arbitrarily to achieve aesthetic goals. Consumer cameras are even starting to do this onboard the camera, in, as far as I know, completely un-documented ways (indeed, they probably consider them trade secrets). See features like iContrast in canon cameras.

    6. Re:Gamma and Computer Vision by drewm1980 · · Score: 1

      > Thus we should fix the real problem, and make the hardware (or at the very least, the OS abtraction layer) conform.

      It seems you are advocating option 2 from my post.

    7. Re:Gamma and Computer Vision by Anonymous Coward · · Score: 0

      How about instead of trying to mess around with gamma values when applying the image transforms, just have all the data formats use a linear color space and then have the display/printer/film printer apply the correct gamma adjustment for what is correct for that hardware? Then one can chain as many processing steps together and not worry if some of them are adjusting for gamma and some not because the only one that does is the one that counts: the output.

  16. Re:Oh dear. Linear color space again, 11 years lat by evanbd · · Score: 3, Informative

    The example images that make it really clear are academic examples. But the scaled photos are all enough of a change to be worth noticing and caring about if you're a serious amateur photographer (never mind professional). And they don't look particularly unusual to me (I haven't looked for odd trickery, but I assume he's being honest here).

  17. Gamma and sRGB by smasch · · Score: 4, Insightful

    The basic issue here has to do with gamma curves and the way they're being handled (they're not).

    Most image files on your computer (BMP, JPG, PNG, etc.) are stored in the sRGB color space. sRGB defines the use of a gamma curve, which is a nonlinear transformation applied to each of the components (R, G, and B). The issue here is that most scalers make the assumption that the components are linear, rather than try to process the gamma curve. While this does save processing time (undoing the gamma curve then redoing it), it does add some error, especially when the values being scaled are not near each other.

    So does this matter? Well, in some pathological cases where there are repeated sharp boundaries (such as alternating black-white lines or fine checkerboard patterns), this would make a difference. This is because the linear average of the pixels (what most image scalers use) yields a different result than if the gamma value was taken into account. For most images (both photographic and computer generated), this shouldn't be a big problem. Most samples are close in value to other nearby samples, so the error resulting from the gamma curve is very small. Sparse light-dark transitions also wouldn't be noticeable as there would only be an error right on the boundary. Only when you exercise this case over a large area does it become obvious.

    One final point: this gamma scaling effect would occur regardless of the actual scaling algorithm. Bilinear, bicubic, and sinc would all have the same issue. Nearest neighbor interpolation would be unaffected, but in these cases, the output would look far worse.

    1. Re:Gamma and sRGB by Anonymous Coward · · Score: 1

      Naturally I did not read the article, but if the above post is correct then this is rather sad as operating on the correct signal space in signal processing and/or image processing is a very basic and necessary aspect to consider. Imagine if your cell phone or VoIP didn't take that into consideration (most audio codecs start out in a-law or u-law companding; similar to the idea of gamma curves).

      Blah.

    2. Re:Gamma and sRGB by Zaphod+The+42nd · · Score: 3, Insightful

      I did RTFA, and yeah, this is pretty sorry. Apparently every image software developer out there cut corners, EVERY one, and it took us this long to notice.

      makes us wonder how much we're missing. Little mistakes here and there...

      --
      GCS/MU/P d- s:- a-- C++++$ UL++ P+ L++ E+ W++ N o K- w--- O M+ V- PS+++ PE Y+ PGP t+ 5- X R++ tv+ b++ DI++ D++ G+ e++ h-
    3. Re:Gamma and sRGB by Anonymous Coward · · Score: 0


      So does this matter? Well, in some pathological cases where there are repeated sharp boundaries (such as alternating black-white lines or fine checkerboard patterns), this would make a difference. This is because the linear average of the pixels (what most image scalers use) yields a different result than if the gamma value was taken into account. For most images (both photographic and computer generated), this shouldn't be a big problem. Most samples are close in value to other nearby samples, so the error resulting from the gamma curve is very small. Sparse light-dark transitions also wouldn't be noticeable as there would only be an error right on the boundary. Only when you exercise this case over a large area does it become obvious.

      One thing that worsen the situation though is noise, which unless excessive or colored (in the frequency spectral sense), won't have a huge effect on low-frequency content (ie, averages out in the larger details), but will bump the differences between neighboring pixels, making the gamma issue more obvious. I think this could be happening with the natural photograph examples posted in the original link (ie, "noise" here would be fine details of nature that scaling largely removes; but since the filter is acting on non-linear scale it gets wrong results).

    4. Re:Gamma and sRGB by xaxa · · Score: 1

      I think it does make a difference. I have lots of photographs of plants (landscapes, up close, etc). I've often been annoyed that they seemed dull when scaled down, e.g. in the gallery on my website, and this would appear to be the cause.

      Try it for yourself. Find a photograph (I used this one -- had to crop it a bit to fit it on ImageBin), and do these:
      convert image.jpg -scale 25% out1.png
      convert image.jpg -depth 16 -gamma 0.454545 -scale 25% -gamma 2.2 -depth 8 out2.png
      compare out1.png out2.png outD.png

      out1.png is scaled the existing way. out2.png is scaled taking into account the gamma. Flip between them. I especially see differences around the stems of plants.
      outD.png is the differences.

    5. Re:Gamma and sRGB by Anonymous Coward · · Score: 0

      TFS says ImageMagick gets it wrong. TFA says ImageMagick gets it right and not only that, can help other applications get it right as well.

      I tested with GraphicsMagick, and it gets it right. Just use this:

      gm convert gamma_dalai_lama_gray.jpg \
                            -gamma .45455 \
                            -resize 50% \
                            -gamma 2.2 \
                            -quality 92 \
                            gamma_dalai_lama_gray_half.jpg

      I have been using this gamma/resize/gamma method with both ImageMagick and GraphicsMagick for years.

    6. Re:Gamma and sRGB by Anonymous Coward · · Score: 0

      Correct but not on all aspects. The gamma 2.2 in sRGB has another curve than the 2.2 gamma of AdobeRGB. Applying one and the same compensation does more harm than the flaw would on normal images.

      The title of the topic shouldn't have mentioned scaling but resampling. Photoshop allows a virtual size definition that can be altered without resampling and by that without the flaw mentioned. If the file then later on is printed through Qimage the resampling to the native resolution of the printer happens, while the size can be kept as defined in PS. That at least reduces the effect to one step only. Qimage has no compensation for this effect but there are far more severe problems in aliasing, sharpening for size etc that it can handle. The image samples discussed wouldn't pass any downsampling if anti-aliasing isn't used and Qimage does that.

  18. Isn't this a bit late? by BoppreH · · Score: 1

    This software have been around for decades. I've seen people turn to macs because they "display colors better", but in all those years nobody filled a bug report about this?

    Color me surprised. With correct gamma, please.

    1. Re:Isn't this a bit late? by Anonymous Coward · · Score: 0

      I've seen people turn to macs because they "display colors better",

      Interestingly, Macs have a standard gamma of 1.8, not 2.2. This bug should therefore be less severe on a Mac.

  19. Important error? by cloudmaster · · Score: 0, Troll

    This bug is so important, that it's been in most all software for longer that many of its users have been alive without anyone noticing it. I'd call that a "minor" bug, and maybe a "stupid" bug - but certainly not "important."

    1. Re:Important error? by Anonymous Coward · · Score: 0

      really? Troll? Moderators haven't been around very long if they think that's a trolling attempt. No wonder kids today are losing in just about every academic competition around.

  20. Digikam 1.0.0 Immune by Anonymous Coward · · Score: 0

    Whew!

  21. Old news (and workaround) by JackHoffman · · Score: 5, Informative

    Ok, so he made a very informative page about it, but this is still a well known effect. It affects practically everything you can do in image editing. Blurs, etc. Most people neither notice nor care. It's rooted in the fact that most images come with undefined black and white points and a gamma chosen for artistic effect rather than physical accuracy. Thus correctly converting to linear gamma is hardly ever possible. You can still correct for monitor gamma to avoid some rarely seen inconsistencies and artifacts, but most people don't even notice, so why bother? However, Photoshop does have everything you need to avoid the effect completely, even in the ancient Photoshop 6.0.

    Here's how to properly resize in Photoshop:

    1. Convert mode to 16 bit (to avoid tone aliasing in the next step, no other influence on the calculations)
    2. Convert to profile, select "Custom RGB", set Gamma to 1.0 (this converts the internal image data to linear gamma, no visible change because the image is color managed and corrected back to monitor gamma on the fly)
    3. Image Size
    4. Convert to profile, select "Custom RGB", set Gamma to 2.2 (default)
    5. Convert mode to 8 bit

    Done. You can substitute your favorite image filter for the image resize. Unsharp mask works much better at gamma 1.0, for example. Of course you can use several filters before converting back to monitor gamma and 8 bit.

    1. Re:Old news (and workaround) by ArundelCastle · · Score: 1

      This is indeed very old news. Looks like the original article is circa 2007, and we're here figuring out that hardly any developers have addressed it.

      Here's how to properly resize in Photoshop:

      Great tip, but sentences like that are part of the problem.
      If Photoshop isn't resizing "properly" it's Adobe's Damn Job to do something about it if they want to charge seven hundred dollars.
      Teaching users how to create an action script doesn't quite cut it. At the *very* minimum there could be a checkbox for "Very Precise Gamma Calculations (25% slower)".

      "Most people don't even notice, so why bother" shouldn't be an acceptable bullet point in industries like medicine, astronomy, military, and engineering. I guarantee all of which use Photoshop, or another image viewer/processor with the same issue.

    2. Re:Old news (and workaround) by Anonymous Coward · · Score: 0

      Step 1: Hit the autocorrect image button.
      Step 2: ??
      Step 3: Profit!
      Step 4: There is no step 4 because most people don't care, the button pressed above made the picture look 'better'.

    3. Re:Old news (and workaround) by ColdWetDog · · Score: 1

      Never heard of this one.... I tried it and found absolutely no difference:

      Open RAW file from a Nikon D2x in Adobe Camera Raw 5.6
      Open another copy - no changes in ACR (both are native size for camera)
      Copy 1 - Change color profile from ProPhoto (my working RGB) to Custom RGB with Gamma set a 1.0
      Copy 2 - Leave in ProPhoto
      Resize to half the original size, same pixel depth (both files)
      Run unsharp mask to taste on Copy 2 (ProPhoto)
      Run same unsharp mask on Copy 1
      Convert Copy 1 back to ProPhoto or custom RGB with gamma 2.2
      Can't tell any difference between the files at 200% EXCEPT that Copy 1 is slightly less bright (the histogram is shifted a bit to the left).
      I didn't convert the files to 8 bit but I don't see where that would change things.

      AmIdoingitright?

      --
      Faster! Faster! Faster would be better!
    4. Re:Old news (and workaround) by Anonymous Coward · · Score: 0

      I kind of agree, but of course correct blending comes at a computational cost. Since those who need that accuracy can enable it by using linear image data with proper meta information, leaving it out doesn't look quite so dramatic to me. You have to know what you're doing. On the other hand, even Photoshop 6.0 already had a "blend RGB colors using gamma 1.0" option in the color settings, complete with the correct description of this option's purpose. Unfortunately it only applies to layer blending, not pixel blending in filters. You can try it by opening the Dalai Lama example picture, copying the layer, moving the top layer down by 1 pixel, setting it to 50 percent and then switching that option on and off. Resizing still combines pixels without concerning itself with gamma calculations.

    5. Re:Old news (and workaround) by r00t · · Score: 1

      1. some photos show it more than others (try a sharp photo of a pile of brightly colored plastic toys, showing well-defined edges between the different colors)

      2. maybe RAW photos start off with gamma 1.0

    6. Re:Old news (and workaround) by Anonymous Coward · · Score: 0

      easier workaround: convert image to 32bpc in Photoshop before scaling. 32bpc mode in Photoshop always calculates in a 1.0 gamma space.

    7. Re:Old news (and workaround) by jcupitt65 · · Score: 3, Interesting

      Yes, it depends on the colourspace you use for the resize. If you resize in a non-linear colourspace, you will get (usually) tiny errors.

      I'm the author of one of the programs listed as defective (nip2). If you care about this issue, all you need to do is work in a linear space, such as XYZ (Click Colour / Colourspace / XYZ).

    8. Re:Old news (and workaround) by Threni · · Score: 1

      > This is indeed very old news.

      Just because no-one's noticed it in over 20 years of use on loads of programs doesn't mean it's not important.

      Uh.. actually, upon reflection, that's exactly what it means.

    9. Re:Old news (and workaround) by Anonymous Coward · · Score: 0

      The ringing around high contrast edges should be less visible when the filter is applied to linear data, because with non-linear data, the ringing is asymmetric: The bright side is brightened more than the dark side is darkened. The difference is subtle, particularly after modest sharpening, which is why most people do not care. To clearly see the effect, you might have to use a higher filter amount than you would normally apply (try 300 percent or higher).

    10. Re:Old news (and workaround) by Anonymous Coward · · Score: 0

      If you have a current version of Photoshop, yes, that is another way to get gamma 1 pixel data. Not all filters work with 32bpc and older Photoshop versions don't even have that mode, so the color profile way is more universal.

    11. Re:Old news (and workaround) by omnichad · · Score: 1

      This is something that was in the 1993 version of Photoshop. I'd say it's been long enough for computing power to catch up.

    12. Re:Old news (and workaround) by Anonymous Coward · · Score: 0

      The bug in Adobe only occurs in 8-bit color space. If you work in 16-bit or greater color space, you're OK.

    13. Re:Old news (and workaround) by Anonymous Coward · · Score: 0

      Not true. Only 32 bit mode uses linear colorspace automatically. In 8 bit and 16 bit modes, the colorspace of the image profile is used internally (usually sRGB with a 2.2 gamma).

  22. Re:Photographer here by adolf · · Score: 1

    TFA says that Photoshop CS3, in 32-bit image mode, handles things properly*.

    *: Where by "properly," I mean "differently than everything else."

  23. Re:Oh dear. Linear color space again, 11 years lat by Animaether · · Score: 3, Interesting

    If you're a *serious* amateur photographer, then you should already know about this and not be using those apps / using them in the color modes (to use Photoshop parlance, as I guess most serious amateur photographers will have a copy (legit or otherwise of that)).

    I guess the argument would hinge on who is a serious amateur photographer and who is just a regular amateur photographer.

    As for the actual examples - sure, you can see the difference.. especially since they're in before/after -style swappable pages. If I presented you a random image off of a random image gallery online, though, would you be able to tell the difference?

    If I showed you an online photo album and pointed at an image's thumbnail, had you click the thumbnail, and open up the full size image.. would you notice that it was scaled to thumbnail incorrectly?

    "Nobody really cares" may have been too broad a statement - but those who really care, already know.. or reasonably should know.
    imho.

    Note that I'm not excusing the software programs from handling this better - certainly not Photoshop - but it's 1. not a new revelation and 2. certainly not a "scaling algorithm bug".

  24. Re:Oh dear. Linear color space again, 11 years lat by Skapare · · Score: 3, Informative

    It's basically an implementation issue. The algorithms may be fine as intended ... in linear space. The programmers that implemented them didn't understand linear vs. gamma, or didn't care, or had a fire breathing PHB on their back. Hence we get junk software.

    At least all MY image processing code always works in linear space. Bu merely converting 8-bit gamma to 8-bit linear is no good because that now introduces some serious quantizing artifacts (major banding effects happen). So I convert the 8-bit gammas to at least 30 or 31 bit integer if I need processing speed, or all the way to double precision floating point if I need as close to correct as possible. After processing, then I convert back to 8-bit gammas. Even then, you can't totally eliminate some banding effects that result from being in 8-bit. If you can get more bits from the raw images from your camera, that's the best to use. Apparently many JPEG compressors are also doing their DCT calculations in the non-unit gamma space instead of the linear space, too (which reduces the effectiveness of the compression somewhat, and may add more compression artifacts).

    --
    now we need to go OSS in diesel cars
  25. Re:Oh dear. Linear color space again, 11 years lat by syousef · · Score: 0

    The example images that make it really clear are academic examples. But the scaled photos are all enough of a change to be worth noticing and caring about if you're a serious amateur photographer (never mind professional). And they don't look particularly unusual to me (I haven't looked for odd trickery, but I assume he's being honest here).

    Really? It looked to me like the images I looked at need to be pretty badly pixelated (resized well beyond what a serious amateur would find acceptable) for this to be a serious concern. Of course some people are always going to be more interested in over analysing their photos than producing good ones...*shrug*

    --
    These posts express my own personal views, not those of my employer
  26. It's not "a software" by jabberw0k · · Score: 1

    This is a scaling performed by a correct software...

    I see this error more frequently lately. Do you wear "a clothing" or buy "a hardware" ? It's a piece of software, or a software program or package. I can haz grammar nitpick point?

  27. Picture Publisher 10 Pro and PMView 3 work fine by gmezero · · Score: 1

    So there you go.

  28. MSPaint scales selection differently by Imnimo · · Score: 1

    Taking the Dalai Lama picture, I get two different results from MSPaint. If I paste the image into a new file, deselect, and then scale the entire image by 50% (in each direction so to 1/4 size), I get the gray box. However, if I select all, and then scale by 50%, I get an odd magenta Dalai Lama. Any insights as to why this might be?

    1. Re:MSPaint scales selection differently by Anonymous Coward · · Score: 0

      Resize vs Resample?

      Or just that the resizing with the cursor uses basic BitBlt API and the resize option does something more advanced.

  29. Old news by spitzak · · Score: 4, Interesting

    My software has been calculating in linear space for over a decade now (this is the Nuke Compositor currenlty produced by The Foundry but at the time it was used by Digital Domain for Titanic). You can see some pages I wrote on the effect here: http://mysite.verizon.net/~spitzak/conversion/composite.html. See here for the overall paper: http://mysite.verizon.net/~spitzak/conversion/index.html and a Siggraph paper on the conversion of such images here: http://mysite.verizon.net/~spitzak/conversion/sketches_0265.pdf, in fact a lot more work went into figuring out how to get such linear images to show on the screen on hardware of that era than on the obvious need to do the math in linear. Initial work on this was done for Apollo 13 as the problems with gamma were quite obvious when scaling images of small bright objects against the black of space.

    For typical photographs the effect is not very visible in scaling, as the gamma curve is very close to a straight line for two close points and thus the result is not very much different. Only widely separated points (ie very high contrast images with sharp edges) will show a visible difference. This probably means you are trying to scale line art, there are screenshots in the html pages showing the results of this. Far worse errors can be found in lighting calculations and in filtering operations such as blur. At the time even the most expensive professional 3D renderers were doing lighting completely wrong, but things have gotten better now that they can use floating point intermediate images.

    One big annoyance is that you better do the math in floating point. Even 16 bits is insufficient for linear light levels as the black points will be too far apart and visible (the space is wasted on many many more white levels than you ever would need). A logarithmic system is needed, and on modern hardware you might as well use IEEE floating point, or the ILM "half" standard for 16-bit floating point.

    1. Re:Old news by Anonymous Coward · · Score: 0

      Here's how to get it to work in After Effects:

      0. File > Project Settings...
      1. pick any working space
      2. check Linearize Working Space
      3. profit

    2. Re:Old news by nrgy · · Score: 1

      Bill where is my rss slashdot feed node for Nuke at? :)

    3. Re:Old news by gmueckl · · Score: 1

      I remember having read the pages that you link to a long time ago. Tone mapping issues are very real and noticable on rendered images - but in subtle way. The lighting just tends to look wrong, as you showed so nicely. I'm trying to get it right in my software, but it's not so trivial. Even if you know you handle it correctly internally, you have to be sure to handle input and output correctly as well. And it's very easy to make a mistake there.

      Still, I'm quite surprised that software like Photoshop that ought to be awfully aware of color spaces does not convert to/from linear automatically. This would be the right thing to do in my opinion. Or does this "loophole" leave some sort of artist control that I'm not aware of?

      --
      http://www.moonlight3d.eu/
    4. Re:Old news by Shinobi · · Score: 1

      I may be remembering it wrong but isn't the problem with linear models for colour/alpha/others, besides the obvious such as gamut, that it makes it harder to replicate features that the human vision expects to catch?

      I wrote a little thing myself waaaaay back for BMRT, for doing self-shadowing particles that also faked photon emission to work with the global illumination system, and with a linear space, things got really ugly, such as "blobbing"/"smearing", odd intersections and similar. Guess I should dig through the archive storage to see if I still have any of that stuff left, to show what I mean.

    5. Re:Old news by spitzak · · Score: 1

      That sounds like you were running into problems converting the linear value to a fixed-point format.

      If for instance you stored 255*value into an 8-bit number, and you looked at the brightness of the value 1, you would see it is quite noticably much brighter than black (it would be as bright as an 8-bit sRGB value of 20). Therefore at the black end you are going to see extreme posterization.

      Raising the number of bits helps but you still end up with surprises. Sometimes lighting does things like divide a value by 10 and then multiply by 10 again later, thus introducing the posterization even with 16 or more bits.

      I don't think you can do linear without also using a floating-point format. In effect you are choosing a logarithmic format (the exponent of the float is very similar to a log), but the CPU knows how to quickly work with the equivalent linear value.

  30. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  31. That *should* read: by GrahamCox · · Score: 0

    That should read: "There is an UNimportant error in most photography scaling algorithms".

  32. Re:Oh dear. Linear color space again, 11 years lat by Anonymous Coward · · Score: 1, Insightful

    One filter where this issue really bites is "unsharp mask". Non-linear gamma results in very noticeable artifacts around high contrast edges. With linear gamma, you can crank the filter strength much higher without producing these artifacts, resulting in very crisp pictures that do not look obviously sharpened.

    It is not a scaling algorithm problem. It's a problem that affects all filters which combine pixels. The only reasonable way to avoid the problem is to hold the image data in memory in a linear representation (as converting it back and forth on the fly every time a filter is applied would quickly accumulate rounding errors). Unsurprisingly every image editing software worth its money already offers that conversion, and doesn't force it on the user because it's not without downsides: The conversion isn't lossless and distributes the tone curve unfavorably in the allocated bits, resulting in either loss of precision at the same bit depth or bigger memory allocations for minimal loss of precision.

  33. Re:Photographer here by spitzak · · Score: 1

    I don't think "32 bit" is what fixed it. What fixed it is that Photoshop also translated to some linear space as a side-effect of whatever he did to convert to 32 bit.

    If you have 32 bits I strongly recommend using floating point in it rather than some image format, and if you have floating point then linear light levels work very good. I also recommend 16-bit half floats if you have 16 bits, attempts to make GIMP support 16 bit integers are a waste of time I think, they should go for half.

  34. FILM is not dead it just smells funny by Anonymous Coward · · Score: 0

    I shoot film so meh

  35. Correct, yes. Expected, maybe. Desired, no. by Animaether · · Score: 3, Informative

    I think the author specifically isn't stating whether the scaling is correct or not - it is; the whole story doesn't relate to scaling at all, but rather color space and how -it- affects, among other, scaling. Yes, with filtering - scaling without filtering can hardly be called scaling at all as you're just discarding data - and for anything but multiples of 2 (4x, 2x, 0.5x, 0.25x, etc.) that'd have a whole 'nother set of problems.

    The author, I think, is suggesting, quite rightly so, that while...

    The grey square shown is the correct result

    ...it is not the expected (by laymen) nor desired (by just about anybody) result.

    The desired result for scaling down likely being that of the same visual image as when you simply stand further back.
    ( although at some point the resolution limit of a display and the image itself being presented on that display prevents that concept from being applied to "moving your eyeballs closer to the screen" for scaling up. )

  36. what's the scope of this? by ILuvRamen · · Score: 1

    So is this like RGB color schemes only in certain scaling modes only? Like if I do a CMYK photoshop project and scale an image down with a non-standard scaling type optimized for reduction or gradient preservation or enlargement or whatever then would it be affected by the glitch?

    --
    Google's Super Secret Search Algorithm: SELECT @search_results FROM internet WHERE @search_results = 'good'
    1. Re:what's the scope of this? by omnichad · · Score: 1

      Yes. Just converted the sample image to CMYK and tried to resize it. Got a grey image. CMYK is also stored with assumed gamma.

  37. omg you're right! it's not news. by decora · · Score: 0

    i demand immediate recall!

  38. Easy fix without changing software by istartedi · · Score: 1

    I have a Shareware app that I purchased something like 15 years ago. It exhibits the bug; but it also has a gamma correction function. I corrected the gamm to 0.46 (approx inverse of 2.2) then scaled the test image of the Dalai Lama, then corrected back to 2.2. It looks fine. YMMV I suppose; but if your app supports gamma correction then by all means try this trick before doing anything more drastic. That's assuming of course that it's really critical for you; which as others have pointed out it probably isn't. Stil though, it's nice to see this pointed out.

    --
    For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
    1. Re:Easy fix without changing software by bstender · · Score: 1

      "for all intents and purposes..."

      --
      look sig is kool
  39. Re:Correct, yes. Expected, maybe. Desired, no. by icegreentea · · Score: 2, Insightful

    Well, as much as desired goes, this also affects how a lot of filters and effects work. For example, it causes most Gaussian blur implementations to 'flare' brights into darks more than they should. And that's been happening for so long, that that's now the expected/wanted behavior out of 'Gaussian Blurs'. If you changed that, you would have some confused/annoyed users.

  40. ok, now that this is fixed by Punto · · Score: 1

    now that this is fixed, can we finally have those infinite resolution zoom-in functions they have in the movies?

    --

    --
    Stay tuned for some shock and awe coming right up after this messages!

    1. Re:ok, now that this is fixed by Anonymous Coward · · Score: 0

      Oh god, I hate that. Because people see it in the movies they expect real-world surveillance systems to be able to do that, and actually get pissed that no solution exists; they think you're just trying to blow them off.

  41. Comment removed by account_deleted · · Score: 1

    Comment removed based on user account deletion

  42. But is it Art? by NotQuiteReal · · Score: 1

    Looks ok to me. Besides, I think I just read a Slashdot article that all digital media is going to rot in the long run.

    In the short run, look for a new marketing bullet point.

    --
    This issue is a bit more complicated than you think.
  43. Wrong by sootman · · Score: 2, Insightful

    "There is an important error in most photography scaling algorithms."

    No, there isn't. If millions of professional users haven't been bothered by it over the course of two decades, it is CLEARLY not important.

    --
    Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
    1. Re:Wrong by Anonymous Coward · · Score: 1, Insightful

      There's a phenomenon called "not knowing what you're missing."

      Anyway, another post linked to examples I find more compelling than those in TFA.

    2. Re:Wrong by Anonymous Coward · · Score: 0

      In response to you and the many dozen other similar comments along this vein strewn all over, carelessly poo-pooing the work.

      This is significant. I, for one, appreciate the amount of detailed work that went into characterizing and explaining the problem.

      I can also well believe that for most photos, and for most kinds of processing that's being done, the "erroneous" results are close enough, and/or it doesn't matter so much.

      But that doesn't lessen the importance of getting this out there and known. It is how progress is made. I know I'll be thinking about these issues the next time I have a image-related coding task at hand. Thank you to everyone involved in bringing these problems to our collective attention. I appreciate it.

    3. Re:Wrong by genik76 · · Score: 1

      Romans were poisoned by lead for years and weren't bothered by it.

    4. Re:Wrong by Inda · · Score: 1

      If it looks right, it is right.

      They all look fine to me, Joe Average.

      --
      This post contains benzene, nitrosamines, formaldehyde and hydrogen cyanide.
    5. Re:Wrong by b4dc0d3r · · Score: 1

      You polled professional users about this question, and none of them cared? Let's see your raw data.

      Professionals have been using lower-gamma monitors for a while because it looks more faithful to the original. They thought it was because the monitor was better quality, or somehow represented the image data better. Turns out it could have been just an artifact of scaling - resizing images in linear space results in a better looking image when your monitor gamma is closer to 1 than 2.2. I'd say that indicates that some people noticed, although they didn't understand what the underlying cause was.

      If you read half the comments here (you might need to adjust your threshold, this is not one of the more moderated topics right now) you'll see other examples. It is important to some people, they have had problems with this.

      When I scrolled through the examples, it was obvious to me that any image that has ever been resized should be re-processed with a fixed algorithm. Images of famous paintings in art books would be a great start, since you're supposed to be seeing what the artist painted, not a rough approximation. It's easy for subtle effects to get lost in the conversion. The line drawing example was all I needed to see to be convinced.

      I've scaled down images to save space before, and noticed that line drawing type images looked off somehow, but I figured if you make the lines thinner (by making everything smaller) you lose density. Kinda like re-scaling a white box on a black background - less white box means the overall brightness decreases. Turns out it just shouldn't be as obvious.

      It bothered me, but since I'm not a professional I suppose you won't count me in your survey.

    6. Re:Wrong by Anonymous Coward · · Score: 0

      Millions of "users" also thought the earth was flat (or, the center of Everything) for well over two decades...

    7. Re:Wrong by sootman · · Score: 0, Offtopic

      You polled professional users about this question, and none of them cared? Let's see your raw data.

      Oh, come on. I didn't poll a million astronomers last night to see if the sun will rise tomorrow either but I feel pretty confident in saying that it will, and speaking for them.

      I'm not saying it's not an issue AT ALL or that it should not be addressed AT ALL, I'm just saying it's not an IMPORTANT issue. Consider this: millions of people have shoes with laces. Sometimes these laces come untied. Once untied, they sometimes cause problems--you might trip over them, they might get sucked into an escalator or wound up in a bike pedal, etc. Are loose shoelaces a problem? YES. Are loose shoelaces an IMPORTANT problem? NO.

      Images of famous paintings in art books would be a great start, since you're supposed to be seeing what the artist painted, not a rough approximation.

      Wow. This is a fantastically bad idea and, not trying to be mean, but it just shows exactly how unqualified you are to have your opinion be counted. There are a MILLION issues at hand that will effect image quality; this tiny gamma shift is WAY down on the list.

      • First of all, there are uncountable thousands of pieces of art out there, so this is bewilderingly impractical to begin with
      • And much of it is too big to scan
      • No sense mentioning things like the Sistine Chapel

      But beyond that, getting into the strictly technical issues...

      • Should the artwork be photographed/scanned in natural sunlight or in artificial light? Indoors or out? What time of day?
      • By the way, with all the pollution in the air now, is the sunlight that comes through your window even the same color as it was in Monet's time?
      • OK, so say you decide that things should be photographed outdoors on a mountain at the equator at noon on the date of the summer solstice. Great. You do realize that any print made from this image (and let's pretend RGB/CMYK issues don't exist, just to make things easier) will look different when viewed inside, through tinted windows (note: ALL glass is tinted to some extent) and artificial light? You can do whatever you want when capturing the image, but if the viewer won't see it under the same conditions, why bother? (Oh, and I almost forgot--you do know that human visual perception isn't a constant, non-moving target, right? Even just looking at something for a while will change how you perceive it.)

      You say "you're supposed to be seeing what the artist painted, not a rough approximation" so obviously you have no idea how TINY the gamut of reproducible colors is compared to actual paint. Try this experiment: Find a museum with a famous colorful painting. Go to a bookstore and buy the most expensive book you can find that contains a print of that art. Find the image online and bring the most expensive laptop you can find too, or a desktop and a calibrated monitor and a LaCie hood if you're really serious. Then compare the two reproductions with the original artwork and, having studied the relative weights of the issues listed above, tell me exactly how much of the giant difference between the original and reproductions was caused by gamma shift due to electronic resizing.

      This is like saying you should steam-clean the under

      --
      Dear Slashdot: next time you want to mess with the site, add a rich-text editor for comments.
  44. By the way: by Hurricane78 · · Score: 1

    Has anyone else noticed the “dark gamma” cancer that came over the Internet since the dawn of cheap LCD displays?

    I have a couple of very carefully calibrated displays here, and pretty much everything on YouTube and every image on the net has a way too deep gamma.
    Which is caused by the LCDs (especially the cheap ones) all being extremely white and having a distorted gamma by default.

    It’s really annoying, since I always have to switch the color profile when I want to see anything in those videos. And images I create for the web end up looking very white on Joe Sixpack’s displays. :(

    I wish there was a way to punch every display company boss in the face for not enforcing proper calibration. :/

    --
    Any sufficiently advanced intelligence is indistinguishable from stupidity.
    1. Re:By the way: by TeXMaster · · Score: 1

      Has anyone else noticed the “dark gamma” cancer that came over the Internet since the dawn of cheap LCD displays?

      I have a couple of very carefully calibrated displays here, and pretty much everything on YouTube and every image on the net has a way too deep gamma. Which is caused by the LCDs (especially the cheap ones) all being extremely white and having a distorted gamma by default.

      It’s really annoying, since I always have to switch the color profile when I want to see anything in those videos. And images I create for the web end up looking very white on Joe Sixpack’s displays. :(

      I wish there was a way to punch every display company boss in the face for not enforcing proper calibration. :/

      I did notice that the displays on both my laptops were much brighter than my old CRT displays, so I set my Windows and X to use a 0.7 gamma which is more or less enough to compensate, but I think I've been luckier than you with what I've come across the interwebs.

      --
      "I'm never quite so stupid as when I'm being smart" (Linus van Pelt)
  45. Editing in RGB is wrong too by buzzn · · Score: 5, Informative

    Several people have spoken about "linear" RGB. That's nice and gets rid of some small level of distortion introduced by the non-linearity. However, it only starts there. For example, the eye sees R, G, and B differently. It is more sensitive to green than red, and to red more than blue, but it's not even that simple as the equations in your eye's processor are much more complicated. Many algorithms that treat the three "equally" are going to change the perceptual mixture. One can use other color spaces, such as HSV, Yuv, xyY, etc. with different advantages and disadvantages

    Sound makes a good analogy. When you play music through any given combination of source, amp and speakers, it sounds different. Sometimes we actually like a particular type of sonic "distortion". It's never exactly like the "original" live music, though.

    Likewise, any graphics manipulation is "distorting" the original. In fact, when I take a digital image and run it through Lightroom, do a range expansion/equalization, and do a bunch of tweaks to make the image look good, I'm making much larger changes than those little scaling problems listed in the article. The point is, do you think the result looks good?

    There's other important variables, such as what colors are next to other colors in the image, how long you look at the image, what else is around you, how tired you are, etc. There's no such thing as color fidelity, there's only approximations to it. Color is hard, and I mean, really hard. See Hunt, "The Reproduction of Colour", or any number of other fine texts to learn more.

    --
    Join the window installer's union, where prosperity is a brick throw away!
    1. Re:Editing in RGB is wrong too by eggnoglatte · · Score: 2, Informative

      Actually, different color spaces are OK, so long as they are just linear transformations from cone space. That is the case for (linear) RGB, (linear) HSV, XYZ, and a few others. As long as the transformation is linear (i.e. just a matrix times the color vector to give you a color vector in the cone space), you can apply any linear operation (such as scaling, blurring, and other weighted sums), and the order of transformation is exchangeable.

      For example, say LMS = M * RGB and you want to average two pixels. Then you have

      RGB_AVG = M^-1 * (1/2 * (M*RGB1 + M* RGB2)) = M^-1*M * 1/2 *(RGB1 + RGB2) = 1/2 (RGB1 + RGB2)

    2. Re:Editing in RGB is wrong too by Twinbee · · Score: 1

      [quote]Sound makes a good analogy. When you play music through any given combination of source, amp and speakers, it sounds different.[/quote]

      Yes, but the point is, the best speakers should be able to *emulate* the other types. In other words, they can do the anything, and it's up to the sample data itself to provide the differences.

      If some kind of distortion sounds 'interesting', or even subjectively better, I want the wave data to be doing that (or maybe some plugin sound alterer), not the hardware. The speaker should only play what it's being fed - no more, no less.

      --
      Why OpalCalc is the best Windows calc
    3. Re:Editing in RGB is wrong too by Anonymous Coward · · Score: 0

      That's exactly the point.

      Almost all image operations are defined on numbers and thus result in different colors when applied in different color spaces. That's by definition. So if you have pixels 0/0/0 and 0/0/100, linearly interpolating the middle point gives 0/0/50. You can't "fix" that.

      Sure, in sRGB this means that the result not only has "wrong" brightness (because of the gamma) but it has a "wrong" hue as well (compared to 0/0/100). Therefore, if you need a perceptually linear color space, you should use L*a*b* - this is what it's there for.

    4. Re:Editing in RGB is wrong too by Anonymous Coward · · Score: 0

      It's not wrong if you edit in 16-bit RGB, which is what ImageMagick/GraphicsMagick does (or can do). Start with an 8-bit JPEG out of the camera, read it into a 16-bit linear RGB, do your editing, scaling, and whatnot, then write out an 8-bit JPEG.

    5. Re:Editing in RGB is wrong too by noidentity · · Score: 1

      Several people have spoken about "linear" RGB. That's nice and gets rid of some small level of distortion introduced by the non-linearity. However, it only starts there. For example, the eye sees R, G, and B differently. It is more sensitive to green than red, and to red more than blue, but it's not even that simple as the equations in your eye's processor are much more complicated.

      Actually, you've got it backwards. Image scaling is just simulating moving closer to or farther from the image, not the eye. But most images are stored in sRGB (or similar), which accommodates the eye's non-linear sensitivity. Thus, when scaling, this a image must be converted to linear first, in order to eliminate this accommodation.

  46. Re:Oh dear. Linear color space again, 11 years lat by Anonymous Coward · · Score: 0

    Helmut Dersch (of Panorama Tools fame) certainly posted about this before;
    http://www.all-in-one.ee/~dersch/gamma/gamma.html - Interpolation and Gamma Correction

    255 / 2 = 122 ???

  47. Is there a way to use this for steganography? by marciot · · Score: 1

    Hummm, can you turn this bug around and come up with an image that appears totally gray in normal size but looks like something recognizable when you scale it up or down? If so, that could be a basis of some cool steganographic hack.

    1. Re:Is there a way to use this for steganography? by taucross · · Score: 1

      Absolutely. This is an old /b/ trick.

      --
      "In the absence of the ability to establish the attribute of truth they tried to establish the noble attributes."
    2. Re:Is there a way to use this for steganography? by omnichad · · Score: 1

      No.

  48. Re:This is what I got when I scaled the image down by Anonymous Coward · · Score: 0

    warning: it's a picture of a dude sticking his own dick up his asshole? wtf??

  49. By Accident by not_hylas(+) · · Score: 1

    By accident, I happen to have the aforementioned (TFA) Lightroom 1.4.1.
    That wasn't skill, that was luck.

    I am a Pro Photographer and I've just purchased (well, the Mrs. got it for me for Christmas) a *Nikon Super Coolscan 9000 WITH matching photon torpedo sleds, complete with very lame software and support.

    I'm about to begin transferring a considerable amount of slides to digital and this is news to me. I still shoot film and plan to continue until pried from my cold dead hands etc., etc.
    The article illustrates to me what I've always seen as a result of a combination of 2.2 gamma and photo manipulation - degradation of image - but I'm not expert in that - this guy is.
    We shoot digital for all the commercial clients and reasons (Hasselblad w/ Sinar back).

    I still use 1.8 gamma, because it sounds cool, actually, because we use a lot of Macintoshes, but never-the-less this guy makes me happy with his findings.
    I can imagine if I’d just been a little bit more on the ball, so to speak, that I’d be finished by now only to be cursing him along with the rest of you, but for a different reason.
    So - this fellow is a God send to me.

    So, I imagine this is where I’m supposed to put in my Flickered link to show you how AWESOME I shoot.
    But I don’t roll that way.
    You’d be hard pressed to find but, maybe five or so released to swarming masses that is - us, basically and they’re heavily watermarked Stegoed, with an occasional Bear Trap.

    But I do have Goodies.

    Get from a friend [or find] a Fuji Finepix Pro S2 - S5, and this ICC profile , install, you'll be amazed.

    FinePix.icc

    These are very nice, also.

    Ekta Space PS 5, J. Holmes.icc:

    http://www.josephholmes.com/propages/AvailableProducts.html

    Beta RGB:

    http://brucelindbloom.com/index.html?BetaRGB.html

    *The Nikon Super Coolscan 9000EN software has .icc profile problems, namely they’re out of spec with OS X 10.4.x (?) up and will have to be substituted with clones to make it work properly.
    See examples below.

    Nikon Scan 4.0.2 [M] /Library/Application Support/Nikon/Profiles/%_NKWide_CPS.icm
          Header profile class is not correct.
          Tag 'desc': Tag size is not correct. /Library/Application Support/Nikon/Profiles/NKAdobe.icm
          Tag 'desc': Tag size is not correct. /Library/Application Support/Nikon/Profiles/NKApple.icm
          Tag 'desc': Tag size is not correct. /Library/Application Support/Nikon/Profiles/NKApple_CPS.icm
          Tag 'desc': Tag size is not correct. /Library/Application Support/Nikon/Profiles/NKLch.icm
          Header connection space is not correct.
          Header data space is not correct.
          Header profile class is not correct.
          Tag 'desc': Tag size is not correct.
          Tag 'A2B0': Number of input channels is not correct.
          Tag 'A2B0': Number of output channels is not correct.
          Tag 'B2A0': Number of input channels is not correct.
          Tag 'B2A0': Number of output channels is not correct. ... ad nauseam

    If you know of someone who’s made the changes please post.

    --
    ~hylas
  50. Re:Photographer here by Anonymous Coward · · Score: 0

    and gegl.
    seems gimp (development versions anyway) already have this solved.

  51. How will this affect emulators? by Schraegstrichpunkt · · Score: 1

    I wonder how this will affect emulators. Did old computers (say, the Amiga) use a gamma of 1.0?

  52. This is nothing new in 3D rendering world by Technomancer · · Score: 1

    Even R300 which was released in 2002 has bits to turn gamma and degamma on on textures and AA resolve. See here http://www.x.org/docs/AMD/R3xx_3D_Registers.pdf and search for gamma.

  53. Re:Oh dear. Linear color space again, 11 years lat by evanbd · · Score: 2, Insightful

    Note that I'm not excusing the software programs from handling this better - certainly not Photoshop - but it's 1. not a new revelation and 2. certainly not a "scaling algorithm bug".

    In what sense is it not a scaling algorithm bug? The images look different after scaling than before, when interpreted in accordance with the appropriate specs. It seems to me that the specification for the scale function is something like "returns an image that is as visually similar as possible to the original, but reduced in size by the specified amount." It might be known, and it might be better described as using the wrong algorithm than an algorithm bug, but it's definitely a bug in the program.

    The rest of the post I basically agree with: the differences are minor except in weird test images. However, if I want to adjust the brightness, I'll do that. If I edit the photo at full res and then save at lower res for use on the web, I don't want the result to look different. I wouldn't be able to tell the difference if not in swappable comparisons, but one might still look better.

  54. Re:Oh dear. Linear color space again, 11 years lat by evanbd · · Score: 1

    The example images that make it really clear are academic examples. But the scaled photos are all enough of a change to be worth noticing and caring about if you're a serious amateur photographer (never mind professional). And they don't look particularly unusual to me (I haven't looked for odd trickery, but I assume he's being honest here).

    Really? It looked to me like the images I looked at need to be pretty badly pixelated (resized well beyond what a serious amateur would find acceptable) for this to be a serious concern. Of course some people are always going to be more interested in over analysing their photos than producing good ones...*shrug*

    I don't see why this is worth defending. It's obviously incorrect, even if the errors are minor. If I resize something, the tool should just resize, not also shift brightness levels. I don't like to over-analyze or over-edit my photos, but I do want my tools do precisely what they're supposed to, neither more nor less. I like manual settings on my camera, and if I want to change brightness levels then I want that to be explicit.

  55. Re:Oh dear. Linear color space again, 11 years lat by Machtyn · · Score: 1

    In some rare cases, yes. And now I know why.

  56. And this is still why, even in 2010. by tengeta · · Score: 1

    The 70 year old professional photographer tells me there is just a difference and digital hasn't made it up yet. He isn't giving up his film camera and I really can't blame him. I guess this isn't the camera's fault and it shouldn't effect them if left unedited, but it makes you question if analog devices and systems should be abandoned at the current rates.

    --
    "They confiscated everything, even the stuff we didn't steal!"
    1. Re:And this is still why, even in 2010. by profplump · · Score: 3, Funny

      The 270-year-old professional portrait artist tells me there is just a difference and photography hasn't made it up yet. He isn't giving up his canvas and I can't really blame him. I guess this isn't the film's fault and it shouldn't affect anything if the subject can be made to hold motionless for several minutes in a brightly-lit setting, but it makes you question if human-driven devices and systems should be abandoned at the current rates.

    2. Re:And this is still why, even in 2010. by Anonymous Coward · · Score: 0

      I think the funniest part about this statement is that I agree with it.

      We shouldn't have abandoned traditional painting as quickly as we did. When we trade artistry for mimicry we remove a valuable human element.

      The raw visual data rarely relays the same message as an individuals representation of the same item. This is not to say photography cannot be art, nor to say it has no uses, but to abandon paint and sculpture as we have is to disregard the value of human representation and interpretation in a great deal of visual mediums. The result is a society that correctly values realism, but incorrectly devalues humanity.

    3. Re:And this is still why, even in 2010. by soliptic · · Score: 1

      We shouldn't have abandoned traditional painting as quickly as we did.

      Since when did humanity abandon painting?

      Loads of people still paint, commission portraits, run galleries full of paintings for you to go and see, or offer art classes for you to go and learn to do it yourself.

      If that is news to you, and you're operating under the impression that paint and sculpture have been entirely abandonded, I really think that says more about you than society.

  57. Re:Oh dear. Linear color space again, 11 years lat by Anonymous Coward · · Score: 0

    I care and I've seen this on day to day photos.

    If a "save for web" or email picture function adds 22% brightness and lowers the picture contrast that sucks.

  58. Ultra Summary by Tablizer · · Score: 1

    The overall error result of the "wrong" scaling is that dark areas "bleed" into adjacent light areas. Light objects shrink slightly relative to everything else in the image and dark objects expand slightly. If there are a lot of high-contrast patterns next to each other, the result of this bleed is an overall darkening of that area.
       

  59. Tux Paint has the code by r00t · · Score: 2, Informative

    The "magic" tools are done right. Scaling (for stamps) needs fixing.

    It's GPL. Grab the code if you want it: rgblinear.c and rgblinear.h have what you need.

    (and yes, the difference is very noticable for special-effect paint tools)

  60. Re:Photographer here by r00t · · Score: 1

    32-bit is of course linear, thus fixing the problem.

    It's rare to have anything 12 bits or more that isn't linear, and rare to have anything 8 bits or less that isn't.

    16-bit half floats aren't natively supported by Intel. You can do 4 floats in an XMM register (SSE) or 4 shorts in an MMX register. Even w/o vectorization, integers and 32-bit floats are easy. Using 16-bit half floats may seem easy in some programming languages, but it's not nice for the CPU.

  61. 2.2? by Tablizer · · Score: 1

    Where did this 2.2 gamma value come from? Is it based on some mathematical or physics truth, or based on tests of human perception?
         

    1. Re:2.2? by drewm1980 · · Score: 1

      It comes from the nonlinear response of the phosphors in CRT's to the number of photons that hit them. Of course, monitors all differ slightly. IIRC magic 2.2 came from microsoft. Apple used (and probably still uses) a different magic number.

  62. not just scaling by r00t · · Score: 1

    In what sense is it not a scaling algorithm bug?

    This affects alpha blending, including anti-aliased drawing tools.

    I think people tolerate it because it's like traditional cartoons: you get a bit of a dark line around everything, more or less. IMHO, that's yucky.

    Serious problems happen when you repeat an operation in the same spot. Things like a smudge tool get an odd sort of asymmetry, with black-to-white and white-to-black operations being different.

  63. bugs filed by r00t · · Score: 2, Funny

    Check the Gimp bug database. It has complaints going back many many years. Trouble is, a bug report is easy to ignore and/or misunderstand.

    Getting this fixed requires sitting down with all the core developers and using small words until it sinks into their thick skulls.

    1. Re:bugs filed by Anonymous Coward · · Score: 0

      gnu developers' skulls are pretty thick, so good luck!

      (a a thick skull is required to support those horns)

    2. Re:bugs filed by Anonymous Coward · · Score: 0

      Check the Gimp bug database. It has complaints going back many many years. Trouble is, a bug report is easy to ignore and/or misunderstand.

      Getting this fixed requires sitting down with all the core developers and using small words until it sinks into their thick skulls.

      I think GEGL, one of the very few softwares that doesn't have this bug was written by those very "thick skulled" developers you are talking about.

  64. This is not really a bug... by Anonymous Coward · · Score: 2, Interesting

    Eric Brasseur, in his otherwise excellent web page on the subject writes:

    Technically speaking, the problem is that "the computations are performed as if the scale
    of brightnesses was linear while in fact it is an exponential scale." In mathematical terms:
    "a gamma of 1.0 is assumed while it is 2.2." Lots of filters, plug-ins and scripts probably
    make the same error."

    That is sort of right in a sense, but the assumption that it is a problem with the scaling algorithm and worse, that it should be fixed in the algorithm are both wrong and a dangerous way to start thinking about this situation. In fact, this isn't really a bug anymore than the misuse of any tool is a bug. What is really needed is more knowledge and expertise on how to create and utilize a color managed imaging workflow.

    Almost all image processing algorithms contain simple addition somewhere and for simple addition to wok as you might expect, the image encoding function must be linear. (Adding logarithms for instance actually results in a multiplication operation. That is how slide rules work. What's a slide rule? Hmmm...) Scaling involves filtering and nearly all filtering algorithms involve addition, but so does a blur, over, blend, key, mask, matte, color correction, dithering and quite a few others. This problem isn't limited to scaling operations and it isn't a actually a bug at all, but rather an education and understanding issue.

    The right thing to do is to linearize your images prior to doing any kind of manipulation and keep them linear throughout the whole image manipulation process, only transforming them to something else for final delivery (or approval if that is an issue). By linear, I mean that the relationship between the luminance encoding and light is linear. You see, it isn't the image or the file that is linear or non-linear, it is that transfer function between code values and light. When I say linear, I mean that for a function f, f(a) + f(b) = f(a+b) and a*f(b) = f(a*b). Anything else is non-linear.

    The problem with working with linear images is that unless you are careful and know what you are doing, your monitor being a non-linear viewing device, won't display the images correctly, so if you linearize your images, they won't look "right" on the monitor, although they will be correct mathematically. The solution to that is to employ LUT in the viewer such that linear data is displayed correctly. Photoshop can do this and has been able to do it for years. The fact that people don't understand how to use that feature and why doesn't mean that there is a bug in the scaling algorithm.

    By the way, high end 2D image manipulation tools like Shake and Nuke to name two are used in the most demanding imaging application possible, motion picture visual effects. With regard to internal image processing, they presume that data is linear. They rely on the expert knowledge of the user to insure that the proper image encoding, that being linear to light is used.

    Lastly, I think thinking of this as a bug in scaling algorithms and trying to fix it by revising scaling algorithms rather than recognizing that it is really a problem with image data being encoded non-linearly is a completely wrong headed approach. It only addresses one use case, that being scaling and ignores all of the other problems with non-linearity. A better approach would be to educate people as to what is actually happening, why it is happening and then just teach them to use the tools they have.

    Just presuming that the input image has a 2.2 gamma and correcting for it in just the case of scaling but not in other 2D image manipulations only just serves to muddle the issue.

    Ultimately, you want is a display subsystem (display card and monitor) that has been profiled and then corrected to match as closely as possible some idealized target like sRGB or Rec. 709 just to name two. The easiest way to do that i

  65. It's very old, but how well known? by Anonymous Coward · · Score: 0

    > Ok, so he made a very informative page about it, but this is still a well known effect.

    Then why is everyone doing it wrong?

  66. you can't avoid it by r00t · · Score: 1

    You WILL assume a gamma value.

    Dumb code implicitly assumes a 1.0 gamma. Most files are approximately the sRGB gamma, which is 2.2 if you ignore some oddities. Very rarely you may encounter an ancient Mac file with a 1.8 gamma.

    So, if you do nothing, you're at 1.0 and sucking hard on most files.

    Applying square and square root (gamma 2.0) is really cheap and easy, and it gets you a lot closer. I think you can even vectorize it in one direction.

  67. And if you're in China . . . by Anonymous Coward · · Score: 0

    . . . you'll probably see an error message.

    Great idea using the Dalai Lama image.

  68. works like a charm by Anonymous Coward · · Score: 0

    wget -O - http://www.4p8.com/eric.brasseur/gamma_dalai_lama_gray.jpg | djpeg | pnmdepth 65535 | pnmgamma -ungamma -srgbramp | pamscale -filter=sinc 0.5 | pnmgamma -srgbramp | display

  69. Not a bug by k-zed · · Score: 1

    This isn't a bug. Don't call it a bug. It's a specific way of operation.

    The results in these program differ from what a *single* person expects - and this person is not a computer graphics person. On the other hand, the results are exactly what many computer graphics people expect.

    The operating domain of these scaling algorithms is a computer image. It has nothing to do with "real" things, and nothing to do with the mistaken imagination of the author of TFA.

    --
    we discovered a new way to think.
    1. Re:Not a bug by Anonymous Coward · · Score: 0

      The results in these program differ from what a *single* person expects - and this person is not a computer graphics person. On the other hand, the results are exactly what many computer graphics people expect.

      I'm a computer graphics person, and I expect that when I scale an image, its size changes and colours do not. If I want the colours to change, I'll do that separately and intentionally.

      This is all very interesting, for years I've been getting some very slightly odd results with some Photoshop operations, but they have been so subtle that I've dismissed them. After all, it's all mathematics which the computers do really well, so the problem must be my eyes...

  70. RTFA by Joce640k · · Score: 1

    The article has seven lines of text followed a section on how to find out if your software has this problem.

    I know this is slashdot but surely you could make it seven lines into an article...

    --
    No sig today...
  71. Simple explanation by Anonymous Coward · · Score: 0

    All of the software in question had already started development before there was any kind of standardization of monitor gamma, at a time where most image formats, even if they had considered the question of how to contain information about the gamma, were written incorrectly without proper gamma information.

    The standard for Apple monitor gamma was 1.6, and for IBM PC monitors it varied but was almost invariably larger.

    So it was impossible for these software projects to "do it right", so they just did it the only way they could, by assuming that gray levels were linear. BTW, that was the case for NetPBM also for at least the first 10 years of its life.

  72. Oh for fucks sake by DeanLearner · · Score: 1

    20 years of image processing wasted, just like that! Spose I better start again...

  73. Re:Gamma and sRGB: Hardware to the rescue? by Terje+Mathisen · · Score: 1

    Afair all modern graphics cards (DX10-11) must have the ability to handle gamma for all sampling operations, i.e. internally they must convert each contributing sample into a linear value before averaging them. BTW, the conversions are not quite log/antilog, a small part of the input range is linear!

    DX10 requires these conversions to be very accurate, with at least 10-bit precision in both directions, so as long as you can live with any of the supported sampling algorithms you can just let the graphics driver do all the hard work.

    If you cannot depend on the hardware, maybe because you'd like to use Sinc sampling, then it isn't too hard or expensive to do it in sw either:

    I have written SSE-based sw to do these operations, which means that the conversions had to use polynomial approximations to make it possible to do multiple of them in parallel. (For a single sample at the time, a lookup table is the obvious choice: A 256-entry table of 16-bit values uses just 512 bytes, while a reverse table going from 11-bit averages to 8-bit gamma samples needs 1KB.)

    Using a very simple polynomial makes it possible to convert 4 individual samples simultaneously.

    Terje

    --
    "almost all programming can be viewed as an exercise in caching"
  74. Re:Photographer here by nrgy · · Score: 1

    32bits doesn't automatically mean the data in the file represents linear light pixel data. I could write a png file with the data in log colorspace if I wanted to, shouldn't but I could if I wanted to. Same goes for writing data to an OpenEXR file.

    Image file formats are containers of data and as Bill posted in a previous thread more often then not the colorspace encoding in files is either read wrong or ignored in the various graphics applications. And don't even get started with Apple applications doing 1.8 gamma encoding.

  75. It's already been discussed on Slashdot by N+Monkey · · Score: 1

    Photographs scaled with the affected software are degraded, because of incorrect algorithmic accounting for monitor gamma.

    Seriously!

    I have a theory on why this has gone unnoticed for so long, but I'll keep it to myself...

    It's already been discussed here in relation to the Gimp, but the maintainers only seem interested in fiddling with the interface. Sigh.

    1. Re:It's already been discussed on Slashdot by orasio · · Score: 3, Insightful

      They summary already names a fix for Gimp (GEGL), but the posters only seem interested in whining instead of RTFS. Sigh.

    2. Re:It's already been discussed on Slashdot by N+Monkey · · Score: 1

      They summary already names a fix for Gimp (GEGL), but the posters only seem interested in whining instead of RTFS. Sigh.

      I just selected "Use GEGL" from the "colours" menu in gimp, downscaled an RGB black&White chequerboard and got a uniform, and incorrect, grey of 128.

      I dug a bit deeper and, if you read the Gimp help, it tells you that it's not working.

    3. Re:It's already been discussed on Slashdot by Anonymous Coward · · Score: 0

      To be fair, the summary doesn't mention that GEGL is part of the GIMP.

  76. not really by r00t · · Score: 1

    The PNG format does not provide for the possibility of more than 16 bits per channel.

    The PNG format does not provide for the possibility of logrithmic data.

    32 bits nearly always means an IEEE floating-point value such that 1.0 is white and 0.0 is black, and 1.0 gamma is used. It's seldom used in files; this is primarily an in-memory format.

  77. Geek bias by Anonymous Coward · · Score: 0

    Funny to see everybody pooh-poohing this effect: "oh you can barely even notice that, who cares", when it's outside their particular expertise, but when the discussion turns to flavours of Linux, or different coding methods or Star Wars trivia, the same geeks get sand all over their vaginas for even more subtle distinctions!

    FWIW, I'm a graphic design professional, and I'd prefer my tools to do what it says on the box. I have little patience with "meh, it's close enough" when we are talking about MATHEMATICS where it's possible get it ABSOLUTELY correct. And if all you need to do is a gamma conversion before and after the operation, I don't buy the "too much work" argument either.

  78. Re:Correct, yes. Expected, maybe. Desired, no. by Twinbee · · Score: 1

    If what you say is really true, those 'annoyed' users would adapt far quicker to the correct approach, than if it were correct to begin with, and everything went to the pear shaped approach.

    We should be simplifying and correcting things (starting at the hardware level, and then moving to the software layer as a last resort), not sticking with arbitrary standards.

    --
    Why OpalCalc is the best Windows calc
  79. Re:Oh dear. Linear color space again, 11 years lat by Anonymous Coward · · Score: 0

    if I want to adjust the brightness, I'll do that.

    You're fired up about this "scaling bug" because someone told you about it, not because it actually matters to you, and the above snippet proves it. Do you know what happens when you "adjust the brightness"? Do you care? Basically all brightness/contrast/levels/curves/whatever adjustments change the colors (and not for just one reason either). Image editing is much more complicated than you think it is. If the effects of non-linear gamma on scaling are news to you, you just got your feet wet. The same basic cause affects everything which combines pixel data or changes existing pixels, i.e. everything. That's why calling it a scaling algorithm bug is wrong. Before we start worrying about non-linear gamma, we should fix the clipping behavior of exposure compensation in most RAW conversion software.

  80. Out of interest... by Anonymous Coward · · Score: 0

    Since I'm not currently in a position to do the experiment, does Photoshop do the filtering operations for scaling in a linear space if you set the "Blend RGB Colors Using Gamma..." option under the color settings? (Or does that only work for blending images?) I can understand the filtering mode being optional, because converting to a linear space and back (especially doing it properly, rather than with a gamma hack) is going to be slow for an arbitrary color space, but I'd not appreciated that Photoshop lacked the option entirely.

  81. As does mtpaint at 616K by spaceturtle · · Score: 1

    Mtpaint has a "Gamma Correction" check box. If you check it you get the faint picture. If you leave it unchecked you get the grey box. Not bad for an editing program that fits entirely in one uncompressed 616KB executable.

  82. Re:Oh dear. Linear color space again, 11 years lat by evanbd · · Score: 1

    if I want to adjust the brightness, I'll do that.

    You're fired up about this "scaling bug" because someone told you about it, not because it actually matters to you, and the above snippet proves it. Do you know what happens when you "adjust the brightness"? Do you care? Basically all brightness/contrast/levels/curves/whatever adjustments change the colors (and not for just one reason either). Image editing is much more complicated than you think it is. If the effects of non-linear gamma on scaling are news to you, you just got your feet wet. The same basic cause affects everything which combines pixel data or changes existing pixels, i.e. everything. That's why calling it a scaling algorithm bug is wrong. Before we start worrying about non-linear gamma, we should fix the clipping behavior of exposure compensation in most RAW conversion software.

    Yeah, it's news to me that it has this impact. (I knew about nonlinear color spaces and such, but never really thought about how it impacted stuff like this — I find it interesting, but I haven't actually written software that cares that much. And now that I think about it, this bug exists in at least a fractal generator I wrote once.)

    But hey, I learn lots of new things about photography. I wouldn't call myself a "serious" amateur, but I know (and care) more about the details than most people. And pretty uniformly, any time I find the camera or software is doing something complicated and automatic, I want the manual version. I use semi-automatic exposure settings more often than fully manual, but there's no way I'd buy a camera that didn't have the manual version. Similarly, I mostly want my software to just stay out of the way. For images I care about, my usual procedure is to take it correctly in the first place, and then I use software to remove noise and scale it down. Occasionally I'll adjust various color options; when I do, I basically just care about a very subjective "make it look good". I may not understand the finer points, but I understand that those tools are fussing with color curves. When I want to fuss with colors, I want that; when I want to scale the image, I sure as hell don't.

  83. vfx crew know this by Anonymous Coward · · Score: 0

    this and many other reasons are why vfx dudes work in linear light and have been for a very long time

  84. Love the summary by rwa2 · · Score: 1

    lol... Just skip down all the way to the end of the article and scale the last image 50%:

    http://www.4p8.com/eric.brasseur/gamma-1.0-or-2.2.png

  85. I thought it was just me by Xabraxas · · Score: 2, Interesting

    I noticed this bug the other day but I thought perhaps I made a mistake somewhere. I am creating a Drupal site for photos and it has a dark background. I was just testing out the image upload and I used an unscaled image. Later I scaled the same image down to save space and re-uploaded the image. The brightness was noticeably different. It's actually very hard to tell in a lot of cases, especially with a brighter background. A dark background really makes the bug apparent.

    --
    Time makes more converts than reason
  86. Re:Correct, yes. Expected, maybe. Desired, no. by omnichad · · Score: 1

    It's not really filtering. It's that the scaling is being done in the wrong color space. If you resize an image, you should convert it to linear data before using averaging and resizing algorithms, and then back to gamma-based values after.

  87. Re:Oh dear. Linear color space again, 11 years lat by omnichad · · Score: 1

    I would take a bet that GD Image Library's JPEG compressor has that bug.

  88. My God is this OLD NEWS by Theovon · · Score: 0, Offtopic

    Sensationalism. This is the kind of sensationalism I used to get into, actually. OMG! GIMP antialiased lines look like ropes because they don't account for gamma properly! (I noticed that 10 years ago.)

    Yeah, so what happens is that these apps scale the image with colors in luma space. In luma space, the color ramp of pixel values looks linear to the human eye. The thing is, the human eye is not linear, so it's technically incorrect to do linear math to combine pixel values in luma space.

    Instead, we should be working in luminance space. Luminance is linear in terms of physical light intensity, and you can do linear math directly on luminance values and have them make physical sense.

    The reason we use luma is because it's more compact to represent what you can SEE in a static image. What takes 8 bits in luma space requires 14 bits in luminance space to get the fine just noticable differences at the right end of the spectrum.

    Most people who have some reasonably advanced education in graphics know ALL about this. And they also realize that it's just not worth worrying about most of the time. I've messed around with gamma-aware scaling, antialiasing, and dithering. Except for very rare circumstances, if you have fine-enough steps in your luma space, it's very difficult to tell the difference, if there even is any. Even dithering to a 6x6x6 color cube looks almost as good in luma as it does in luminance. The only situation where it's vital is if your color space is really small. For instance, if you wanted to dither a color image to a 2x2x2 color cube (8 colors), then ignoring gamma makes it look completely wrong.

    I'll make a physics analogy. This guy is complaining that Newtonian mechanics is inaccurate compared to Einsteinian, except that we're dealing with speeds of 100s of miles per hour. Not going to make a noticable difference.

  89. Could some one explain the following then by goombah99 · · Score: 1

    I work with RGB for science purposes all the time. To me the RGB levels are directly proportional to the number of photons collected. If I fuse ccd pixels then the number of photons collected is just the sum of the pixels counts. If this were my eyeball and not a photon collector then the same logic applies. If you reduce the number of pixels it's like focusing the image to a smaller portion of your retina. Each rod will collect proportionally more photons.

    thus if I reproduce this image on scree so that the number of photons leaving a pixel is proportional to the RGB level then this is reproducing the image as I would have seen it.

    When I go to display this on a screen, then the graphics system will naturally apply a gamma correction. This correction is there to correct for the screen phosphor response NOT the eyeball's response. It is intended to make it so that 128 has twice the photons as 64.

    Thus I think the analysis is wrong. You don't want to average in gamma space. you want to average in RGB space then apply a gamma just like is being done.

    I think the real problem is that when you sum pixels their not only is the sum larger but the dynamic range of the image pixels is larger. Thus if you need to compress this back to 8 bit dynamic range you have a problem.

    So my conclusion is the problem is NOT that you want to do
    pixel^gamma -> average regions -> pixel ^(1/gamma)

    but instead average lineraly
    pixel^gamma -> sum regions -> ??? some how compress dynamic range ????

    I don't know what the correct compression is. But it makes no sense to me to non-linearly sum things that correspond to actual photon counts.

    SO either I misread the article (don't think so), or the article is right about there being an overall dynamic range compression issue but wrong about the solution, or I am not understanding some key concept here.

    can someone explain to me what I'm missing?

    --
    Some drink at the fountain of knowledge. Others just gargle.
    1. Re:Could some one explain the following then by systemeng · · Score: 1

      He is right that the eye has a logarithmic response. Unfortunately, most digital sensors have a linear response. In this sense he is wrong. If you scale sensor data, the linear scaling is right. I suspect his anomaly is due to overflow in the linear calculation and the fact that the logarithmic calculation won't overflow. For scientific data, there's no way one would want his scaling calculation. If on the other hand, you scale a gamma corrected image from a linear sensor using the ordinary linear scaling I can see that you might get the problem he is describing.

    2. Re:Could some one explain the following then by drewm1980 · · Score: 1

      Unless you are using a high-end camera built for machine vision and scientific purposes that you are certain has a linear gamma curve, the numerical values in the image files are ~not proportional to photon counts. Likewise, if you display a linear ramp of data as an image (say using something like MATLAB's imshow(repmat(linspace(...),...)), your monitor will not emit a linear ramp of photon intensity. Until MATLAB, PIL, opencv, et al provide build-in conversion functions, you're going to have to use a home-rolled gamma conversion functions whenever you display data, and whenever you load data from an image file (unless you used a camera that you're sure is linear).

    3. Re:Could some one explain the following then by SETIGuy · · Score: 1

      For scientific purposes you are correct. When used for scientific purposes, CCDs are linear detectors, and you want to do normal linear math on them, because you are interested in the number, not how the picture looks However, human perceptions aren't linear with color or intensity, nor do human brains tend to interpolate each of the color channels across discontinuities. Our brains expect an edge to be sharp. When we see a boundary between red and blue, our brains don't perceive a blurry purple edge.

      I see this as a problem of working in the wrong coordinates. Rather than working in RGB space and doing interpolations there (which would be valid for scientific purposed) imaging software for photo-reproduction purpose should be operating in a perceived luminance vs color space. The gamma approximation is one way to get close to what an out of focus eye would see.

  90. what is the affect on color distances calculations by swframe · · Score: 1

    (This may be off topic, in which case, please ignore.) I was wondering if rgb should be converted to linear before computing color distances? And, what is the better way to compute color distances (since the euclidean distance of rgb values seems like a really bad choice).

  91. The camera post-processes the sensor data by N+Monkey · · Score: 1

    He is right that the eye has a logarithmic response. Unfortunately, most digital sensors have a linear response. In this sense he is wrong. If you scale sensor data, the linear scaling is right. I suspect his anomaly is due to overflow in the linear calculation and the fact that the logarithmic calculation won't overflow.

    If you have a camera that can output a raw data file then, yes, the values will be linear, but for standard JPEG (or video) output, the camera will have mapped the linear data to non-linear.

    1. Re:The camera post-processes the sensor data by goombah99 · · Score: 1

      N MOnkey, this is terribly important to me to understand so could you explain a bit further.

      When you say JPEG, RAW and RGB it's not perfectly clear what is be said casually and what is being said specifically. The article itself and some other comments refer to RGB data as having either a specified gamma or an implied gamma of 2.2.

      this is news to me and about 100 million other people.

      I've never looked to see what is litterally written in a binary RGB file, but when you open one in any of a zillion different tools like python Image module or Matlab what you get are three integer arrays for R, G and B.

      the assumption one makes is that these integer values are not photons ^( 1/gamma) but simple photon counts (scaled to the 0-255 range).

      Now when you say JPEG, yopu might literally mean something special about a jpeg file. or you might simply be referring to some file format that is a container for an RGB image. so it's not really clear to me if you are saying that

      1) the stored values in a Jpeg are photons^(1/gamma)

      2) but this is well known and if you ask a program to give you the data in RGB it will correct the jpeg storged values back to linear photons (jpeg pixel)^Gamma --> RGB pixel.

      or you might be saying that if I have a Jpeg and I extract the RGB image then indeed all the values are photons^(1/gamma).

      or maybe you are saying something else. please be pedantic and help me understand this precisely.

      thank you.

      --
      Some drink at the fountain of knowledge. Others just gargle.
    2. Re:The camera post-processes the sensor data by drewm1980 · · Score: 2, Insightful

      "the assumption one makes is that these integer values are not photons ^( 1/gamma) but simple photon counts (scaled to the 0-255 range)."

      That is a very reasonable assumption to make, and one that most people who don't know anything about gamma make. Unfortunately, it's flat out false. Both MATLAB and PIL return the gamma compressed data, which, unless you used a linear machine vision camera (and you should if you're serious about this stuff), which of course had no gamma compression to begin with. If you need proof, load and save an image. The image data will be bit for bit identical to the original, indicating that no conversions were performed. (note that the header might have slightly different metadata, and JPEG re-compression is usually always lossy)

      Gamma is so rarely handled properly, even by scientists and engineers, that OpenCV (the most popular library for computer vision) does not even contain a function for doing gamma (de)compression.

    3. Re:The camera post-processes the sensor data by drewm1980 · · Score: 1

      Unfortunately, RAW files are not even a guarantee of linearity; I've heard of cameras that do gamma compression in the analog domain, i.e. before digitization.

    4. Re:The camera post-processes the sensor data by amorsen · · Score: 1

      JPEG doesn't store RGB at all...

      --
      Finally! A year of moderation! Ready for 2019?
  92. thank you by Anonymous Coward · · Score: 0

    Thank you, that is a very clear explanation of this problem and how gamma affects output. I can finally visualize what is being talked about here :)

  93. Does he even realize... by Anonymous Coward · · Score: 0

    zomg!
    His inversion routine used on every other line in the original image is flawed!
    It's working in linear space (gasp) otherwise the resulting images would have been switched.

    (tongue in cheek)

  94. Re:Gamma and sRGB: Hardware to the rescue? by amorsen · · Score: 1

    Is any of the code you have written available under a free license? I realize that what you have written for geological analysis software is likely to be kept private, but perhaps there's other bits of code which could be helpful to the rest of the world?

    --
    Finally! A year of moderation! Ready for 2019?
  95. Re:Gamma and sRGB: Fast log2() code by Terje+Mathisen · · Score: 1

    Here's a snippet of code I wrote 3 years ago: /*
      * The first part is semi-magic, it depends on doing a small amount
      * of fast bit-twiddling operations directly on the fp bit pattern:
      *
      * Treat the fp value as an Int
      * Take the top 16 bits of the mantissa and
      * the last exp bit, adjust that bit:
      * Square it for a second-order correction:
      * The fp exponent is nearly a log:
      * The 2nd order term must be scaled by 5/8196
      */

    inline int rr_log2(float f)
    {
            int e = AS_INT32(f);
            int m = ((e >> 7) & 0xffff) - 0x8000;
            m *= m;
            e += (5>= 13;
            e -= m*5;
            return e;
    } // The float->float code uses the function above, converting // back to float and scaling by 2^(-23):
    inline float RR_LOG2(float f)
    {
            int e = rr_log2(f);
            float t = (float) e * (float) (1.0f/(65536.0f*128.0f));
            return t;
    }

    Terje

    --
    "almost all programming can be viewed as an exercise in caching"
  96. Re:Oh dear. Linear color space again, 11 years lat by syousef · · Score: 1

    I don't see why this is worth defending. It's obviously incorrect, even if the errors are minor. If I resize something, the tool should just resize, not also shift brightness levels. I don't like to over-analyze or over-edit my photos, but I do want my tools do precisely what they're supposed to, neither more nor less. I like manual settings on my camera, and if I want to change brightness levels then I want that to be explicit.

    It's not a matter of defending it. It's a matter of whether or not it's significant in most real world photography.

    It's also not necessary to look at this is as incorrect. You can think of it as deviations on an algorithm. In other words what they are "suppose to" do is open to some interpretation. There are in fact several common algorithms for resizing. If you care so much let me ask you how often you change to a different algorithm in the dialogs? Do you choose your software based on the options available in a resizing dialog? Or is this noteworthy but being blown way out of proportion?

    --
    These posts express my own personal views, not those of my employer
  97. So what....who cares!? by Anonymous Coward · · Score: 0

    "Photographs scaled with the affected software are degraded, because of incorrect algorithmic accounting for monitor gamma. The degradation is often faint, but probably most pictures contain at least an array where the degradation is clearly visible. I believe this has happened since the first versions of these programs, maybe 20 years ago."

    And yet, for the last 20 years, the porn I look at is crystal clear!

  98. Questions is... by fly1ngtux · · Score: 1

    Who wrote the original buggy code and who all copied it?
    This may be a real bug and might have come from some wrong/incomplete understanding that existed 20 years back. But somehow I can get the above question out of my mind...

  99. Consequences.... by rickshaf · · Score: 1

    Have any images exploded due to this glitch? When will the recall be announced?

  100. Re:Gamma and sRGB: Fast log2() code by amorsen · · Score: 1

    Excellent, but it's difficult to actually use it in code without a license... This code is so short that some can argue that copyright does not apply, but it is highly non-trivial and so I don't think that argument would be likely to hold up in court.

    The same applies to the snippets of code you sometimes publish on comp.arch: Very interesting, but there's no mention of a license.

    --
    Finally! A year of moderation! Ready for 2019?
  101. Copyright on code snippets by Terje+Mathisen · · Score: 1

    I'm perfectly happy, and assume, that any code snippets I post will be picked up and reused. If whoever does this includes a comment that I wrote it originally, that's all I expect.

    Terje

    --
    "almost all programming can be viewed as an exercise in caching"
  102. Re:Oh dear. Linear color space again, 11 years lat by Anonymous Coward · · Score: 0

    From the gamma FAQ:
    On the other hand, if your computation involves human perception, a nonlinear representation may be required. For example, if you perform a discrete cosine transform on image data as the first step in image compression, as in JPEG, then you ought to use nonlinear coding that exhibits perceptual uniformity, because you wish to minimize the perceptibility of the errors that will be introduced during quantization.

  103. Re:what is the affect on color distances calculati by buzzn · · Score: 1

    The usual concept is "delta-E", which tries to approximate color distance, but how accurate it is depends on the color space you are calculating with. http://www.colorwiki.com/wiki/Delta_E:_The_Color_Difference

    --
    Join the window installer's union, where prosperity is a brick throw away!
  104. Whaa...? by Anonymous Coward · · Score: 0

    Who is that bald dude? I wanted my lines in the smaller image, not him!