Re: When neutral 50% gray isn't 50%: elementary gamma question
From: F. H. (yay_frogs_at_yahoo.com)
Date: 10/07/04
- Next message: Marlboro: "Re: problem with BMP files"
- Previous message: ghost: "Re: Contour approximation"
- In reply to: Dave Martindale: "Re: When neutral 50% gray isn't 50%: elementary gamma question"
- Messages sorted by: [ date ] [ thread ]
Date: 7 Oct 2004 12:27:23 -0700
davem@cs.ubc.ca (Dave Martindale) wrote in message news:<ck16u5$bvl$1@mughi.cs.ubc.ca>...
> yay_frogs@yahoo.com (F. H.) writes:
> >I've been reading a lot of material about gamma in an effort to
> >educate myself and I'm a bit confused about why the cross-platform
> >gamma issue even exists: on a correctly configured Mac and PC with
> >24-bit color, shouldn't (128,128,128) be a neutral ~50% gray,
> >(64,64,64) be a ~25% gray, and so forth?
>
> No, it should not, and that's the basic misunderstanding behind your
> questions.
>
> If you had a 48-bit frame buffer (16 bits each for red, green, and blue)
> it would be OK to store images with pixel values linearly proportional
> to light intensity. So 65535 would be white, 32768 would be 50% gray,
> 16384 would be 25%, and so on. This would give enough resolution in
> intensity to avoid artifacts even in the darkest areas of an image,
> which may be 1/1000 as bright as the brightest areas. But such a frame
> buffer would cost too much, because it would need twice as much RAM for
> the same image, and three lookup tables of 65535 entries operating at
> the pixel clock rate.
>
> If you try storing linear 8-bit data in the frame buffer, as you
> describe above, you'll get quantization problems in the shadows. If
> white is 255, shadow detail a mere 7 stops darker is a digital code
> value of 2. The next brighter code is 3, 50% brighter, while the next
> darker code is 1. This quantization is just too coarse.
>
> So, what is done instead is to store already gamma-corrected data in the
> 8-bit frame buffer, and use little or no correction in the lookup tables
> of the graphics card. All the JPEG images you see on the web are
> already gamma-corrected, not linear. They are decoded into the frame
> buffer and then sent to the CRT without further change (in most cases).
> If you want 50% grey, you need a pixel of (187, 187, 187), not (128,
> 128, 128).
>
> >As I understand gamma, a gamma-uncorrected CRT that is told to display
> >25% or 50% gray will display something darker: for instance, 50% gray
> >will display as .50^2.5 = ~17.7%. However, applying a gamma correction
> >of 2.5 will again make the 17.7% be 50%: .177^(1/2.5) = ~50%.
>
> Right. But, in practice, most or all of the correction is applied to
> the *data* before it is quantized to 8 bits per colour. In the case of
> digital cameras, for example, this happens in the camera before writing
> the JPG. In computer-rendered images, it happens during the floating
> point to integer conversion in software.
>
> > A Mac, I have read, does partial hardware correction, so the correct
> >value in the exponent is 1.8 instead of 2.5. (Additionally, the 2.5 on
> >the PC is usually "under-corrected" to 2.2 because this is better for
> >a dim viewing environment and it is the standard for television which
> >assumes a dim environment.)
>
> Right. The Mac approach makes a Mac screen perform approximately like a
> printing press, so you can judge how your images will print and adjust
> till you like them. But this was before the days of colour management
> systems.
>
> >So here's where I get confused: if a PC is making a (128,128,128)
> >input pixel be 50% gray again by applying a 2.2/2.5 correction in
> >software and a Mac is making a (128,128,128) input pixel be 50% gray
> >again by applying an additional 1.8 software correction to a built-in
> >correction, then why does a (128,128,128) input pixel still look
> >lighter on a Mac than a PC, and the same image look lighter on a Mac
> >in general? When both PC and Mac are displaying the same black and the
> >same white, shouldn't they be displaying the same 50% gray also?
>
> Answer: a (128, 128, 128) pixel is not 50% grey on *either* system;
> it's about 22% grey on the PC and 29% grey on the Mac. So if you
> display a PC-specific image on the Mac, what should have been 22% grey
> is displayed as 29% grey - too light. It's not just the hardware and
> software displaying the image that's different, *the data is encoded
> differently for the Mac than the PC*.
>
> >People talk about gamma correcting an image for 1.8 or 2.2, but if the
> >correction is already being done by a combination of the OS software
> >and the video card hardware, then why is correction necessary? Why
> >can't an image just be linearly coded so that a (128,128,128) pixel is
> >assumed to be ~50% gray, since that's the way it should appear on both
> >a PC and Mac in the end?
>
> Because linear coding does not work well for photographic images until
> you get at least 12 bits per component. If you have only 8 bits, you
> need to make careful use of the 256 codes available, and doing the
> non-linear "gamma correction" transform before quantization is a nearly
> ideal way to do this. You'd want to do it even if your display is not a
> CRT and has nothing like a power-law response, if you have only 8 bits
> per colour.
>
> Dave
Dave,
In a sea of confusing and contradictory information about gamma (such
as what I was reading in the link to Timo's page about why we should
be doing gamma=1.0 editing, which obviously is impossible until we
have 12-16 bits per channel), your post has been most extraordinarily
enlightening.
I guess this brings up my next question, which I guess relates to
color management systems: I'm currently using a Mac and most photos
that I look at on the Mac, including almost all web photos as well as
digital photos I import using Apple's own iPhoto software, tend to
look washed out and pretty terrible. People look somewhat ill to be
honest, as the color in their lips and skin is paler than it should
be. If I open photos in Adobe Photoshop CS set to use the sRGB working
space then suddenly the life flows back into them, colors saturate
more, and they look great again. I tried changing my Mac gamma from
1.8 to 2.2, and this seems to reduce the washed-out look somewhat but
it still looks washed out and different than when it's loaded in
Photoshop CS. Also, the system gamma change doesn't affect how they
display in Photoshop as Photoshop smartly is aware of the system
setting and compensates so that images display the same regardless of
how I've set system gamma.
At this gamma explanation site about cross-platform images there is a
picture of a little girl with both 1.8 and 2.5 correction:
http://www.siggraph.org/education/materials/HyperGraph/color/gamma_correction/gamma.web.html
Actually, I'm not certain that it's 2.5 correction, but playing around
with the gamma slider in the Mac display calibrator, it looks like the
PC image doesn't match the Mac image on my display until the slider is
slid to about 2.5 instead of 2.2.
Anyways, if I open both PC and Mac images of the girl in Safari or OS
X's Preview application and then I again open both images in Photoshop
CS so that I have four images on screen, the two images in Photoshop
look much better than the two images in the OS X application, so
there's something going on here besides gamma that is affecting color.
If I set the Photoshop working space to be my monitor's profile (that
I obtained using a Gretag Macbeth Eye One Display calibrator) then
images inside Photoshop again match how they awfully display in the
rest of OS X. It's as if Photoshop is somehow aware of the way my
monitor displays color and is correcting according to sRGB while the
rest of OS X just leaves everything looking washed out. Inside the OS
X display profile selector in the Control Panel there is a sRGB
profile that can be selected but it doesn't seem to change anything at
all, while selecting sRGB in Photoshop makes a dramatic difference.
It seems like there should be a way to tell my Mac that I want it to
be aware of my monitor's Eye One ICC profile and to provide me an sRGB
or Adobe RGB working space based on that profile. However, it seems
like my Mac will only give me what Photoshop CS calls my monitor's
working space. (I should also mention that if I set Photoshop's
working space to Adobe RGB instead of sRGB there is again a dramatic
intensification of color that makes a lot of images look more
impressive, but I'm not sure if the colors are as accurate in all
cases.)
Right now I have a really annoying situation in that if I want a photo
I'm viewing with the Safari web browser to look good I first drag it
onto my desktop to save it and then I drag it to the Photoshop dock
icon to bring it up in Photoshop and see what I presume it's really
supposed to look like. I'm wondering if anyone out there in Mac land
has noticed this and knows of a fix.
One final question: if you want to do image color editing without
introducing errors because of gamma correction, would converting the
image data to a linear 16-bit per channel color space currently work
even without 16-bit per channel hardware? In other words, could the
same 16-bit per channel tiff file be automatically displayed properly
on both an 8-bit per channel PC and a 8-bit per channel Mac without
special system-dependent coding? (If I'm understanding correctly then
the answer is yes, as long as it's not a true 48-bit image but rather
a 24-bit image coded using 48 bits to preserve the proper dynamic
range of values and relative intensities.)
- Next message: Marlboro: "Re: problem with BMP files"
- Previous message: ghost: "Re: Contour approximation"
- In reply to: Dave Martindale: "Re: When neutral 50% gray isn't 50%: elementary gamma question"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|