# How to understand 18% gray?

Discussion in 'Digital Photography' started by Steven Woody, Nov 26, 2007.

1. ### Steven WoodyGuest

why 18% gray is in the mid of the full scale of brightness from
darkest to brightest? what's the math behind it?

Steven Woody, Nov 26, 2007

2. ### EALGuest

On Sun, 25 Nov 2007 21:37:51 -0800 (PST), Steven Woody
<> wrote:

>why 18% gray is in the mid of the full scale of brightness from
>darkest to brightest? what's the math behind it?

It really means that 18% of incident light is reflected.

Human perception of brightness is logarithmic, though, and not linear.
Compound interest is logarithmic. So is the frequency of the notes on
a piano. So is the decibel scale for measuring sound pressure.
Likewise with the light plotted on a typical histogram.

You can make (or imagine) a set of brightness patches by starting with
100% reflection and halving each time. The next is 50%, then 25%,
12.5%, 6%, 3%, and 1.5%. That's 7 patches. It is a logarithmic
sequence; the factor is 1/2. The first patch is white, the last very
dark gray, virtually black. In the middle it will be middle gray,
12.5% actually, a bit darker than 18% gray.

You can fiddle with sequences like this to make as many patches as you
like, with different gradations of brightness between them. Using a
factor of 0.75, we get 13 steps, with the middle being 18%:
100 75 56 42 32 24 18 13 10 7.5 5.6 4.2 3.2.

Ed

EAL, Nov 26, 2007

3. ### Kevin McMurtrieGuest

In article
<>,
Steven Woody <> wrote:

> why 18% gray is in the mid of the full scale of brightness from
> darkest to brightest? what's the math behind it?

It can be mid-way for exponential gamma.

The exponential gamma has its origins in old tube TV circuits but it
remains in use because it models visual perception reasonably well. It
shifts more digital levels into areas where the eye is most sensitive.
Few things in the natural world are linear.

Kevin McMurtrie, Nov 26, 2007
4. ### cmykGuest

"Steven Woody" <> wrote in message news:...
> why 18% gray is in the mid of the full scale of brightness from
> darkest to brightest? what's the math behind it?

See:
doug.kerr.home.att.net/pumpkin/Scene_Reflectance.pdf
and
doug.kerr.home.att.net/pumpkin/Exposure_metering_18.pdf

Cheers
--
cmyk

cmyk, Nov 26, 2007
5. ### Joseph MeehanGuest

Despite the science behind it, in reality it is the art that counts.
For most situations 18% works well. However for some situations and for
some expectations of a result some other gray will work better.

In other words, don't worry so much about the science of photography
that it gets in the way of the art.

"Steven Woody" <> wrote in message
news:...
> why 18% gray is in the mid of the full scale of brightness from
> darkest to brightest? what's the math behind it?

--
Joseph Meehan

Dia 's Muire duit

Joseph Meehan, Nov 26, 2007
6. ### David J. LittleboyGuest

"Steven Woody" <> wrote:

> why 18% gray is in the mid of the full scale of brightness from
> darkest to brightest? what's the math behind it?

While the "logarithmic" answer people have given is correct, it's easier to
see if you remember that a one stop difference means a twice the brightness.

So if you have mid-gray at 18%, you get five (that's all, folks) useful
tones on a print: 4.5%, 9%, 18%, 36%, and 72%. If you toss in 0% and 100%,
that makes 7 (although you probably won't be able to see the difference
between 4.5% and 0).

David J. Littleboy
Tokyo, Japan

David J. Littleboy, Nov 26, 2007
7. ### DouglasGuest

"David J. Littleboy" <> wrote in message
news:...
>
> "Steven Woody" <> wrote:
>
>> why 18% gray is in the mid of the full scale of brightness from
>> darkest to brightest? what's the math behind it?

>
> While the "logarithmic" answer people have given is correct, it's easier
> to see if you remember that a one stop difference means a twice the
> brightness.
>
> So if you have mid-gray at 18%, you get five (that's all, folks) useful
> tones on a print: 4.5%, 9%, 18%, 36%, and 72%. If you toss in 0% and 100%,
> that makes 7 (although you probably won't be able to see the difference
> between 4.5% and 0).
>
> David J. Littleboy
> Tokyo, Japan
>
>
>

Perhaps a usefulness not yet explained or stated is for matching colour. I
use a white, black and grey card (home made) in the first shot of a scene. I
use it with the "levels" function of Photoshop and so far (maybe 1000
frames) it works better than nearly any other post shoot white balance.

I don't believe digital photography has the same use for a grey card as film
shooters have.

Douglas

Douglas, Nov 26, 2007
8. ### Dave MartindaleGuest

Steven Woody <> writes:
>why 18% gray is in the mid of the full scale of brightness from
>darkest to brightest? what's the math behind it?

It isn't exactly in the middle, really. Any given scene has a darkest
tone you want to record and a brightest tone you want to record, and the
middle tone for that particular scene is halfway in between.

Now, it's not halfway between in linear-light space, because the eye
responds logarithmically. Suppose you have a scene whose brightness
ranges from 1 to 100 on some arbitrary (but linear) light meter scale.
To the eye, a brightness of 50 is "one step" darker than 100, and 25 is
an equal-sized step darker than 50, 12 is another step darker again, and
so on. So the midtone for this particular scene is actually a
brightness of 10, in the sense that it is just as much brighter than the
minimum (10X) as the maximum is brighter than the midtone (10X).

One general way to calculate this is:

midtone = sqrt(min_bright * max_bright)

This value is called the "geometric mean" of min and max brightness.
You can also average logarithms:

midtone = exp( (log(min_bright) + log(max_bright)) / 2)

The magic value of 18% comes from somewhere else. Someone did a study
and found that the average reflectance of a large number of
photographic scenes was 18%. So if they set their incident light meter
to assume that light from the scene was 18% of the light falling on the
meter, they would (on average) get a good exposure. Similarly, if they
had an 18% reflectance grey card, and measured the light on it with a
reflected light meter, that would also be a good exposure.

It happens that, in many scenes, the average scene brightness is
actually pretty close to the middle tone (halfway between darkest and
lightest areas of interest), so it's also useful to expose as if it was
the middle tone, giving equal range above and below it. But that's not
necessarily true, and spotmeters and the zone system are tools for more
accurately figuring out what the tonal range of your scene is, and how
to place that relative to what your film (or sensor) can capture.

Dave

Dave Martindale, Nov 26, 2007
9. ### Neil EllwoodGuest

Steven Woody wrote:

> why 18% gray is in the mid of the full scale of brightness from
> darkest to brightest? what's the math behind it?

Go back 100 years or so and ask.

--
Neil
reverse ra and delete l
Linux user 335851

Neil Ellwood, Nov 26, 2007
10. ### Peter IrwinGuest

Steven Woody <> wrote:
> why 18% gray is in the mid of the full scale of brightness from
> darkest to brightest? what's the math behind it?

The gray card is a development of the "artificial highlight"
method of exposure metering. Before the gray card was invented,
Kodak recommended using a 90% white card and setting your light
meter at 1/5 of the normal film speed rating. The gray card
simplifies this because you don't need to change your meter setting.

90/5 = 18

Peter.
--

Peter Irwin, Nov 26, 2007
11. ### David J. LittleboyGuest

"Douglas" <> wrote:
> "David J. Littleboy" <> wrote:
>> "Steven Woody" <> wrote:
>>
>>> why 18% gray is in the mid of the full scale of brightness from
>>> darkest to brightest? what's the math behind it?

>>
>> While the "logarithmic" answer people have given is correct, it's easier
>> to see if you remember that a one stop difference means a twice the
>> brightness.
>>
>> So if you have mid-gray at 18%, you get five (that's all, folks) useful
>> tones on a print: 4.5%, 9%, 18%, 36%, and 72%. If you toss in 0% and
>> 100%, that makes 7 (although you probably won't be able to see the
>> difference between 4.5% and 0).

Note that Dave M. has provided a much better discussion of this issue than
the above.

> Perhaps a usefulness not yet explained or stated is for matching colour. I
> use a white, black and grey card (home made) in the first shot of a scene.
> I use it with the "levels" function of Photoshop and so far (maybe 1000
> frames) it works better than nearly any other post shoot white balance.

I don't recommend this. I have two Kodak gray cards here that have radically
different color compositions: one is somewhat blue, the other quite warm.

David J. Littleboy
Tokyo, Japan

David J. Littleboy, Nov 27, 2007
12. ### Steven WoodyGuest

thanks for all your explains and that actually made me in the way of
understanding. now, another question poped up in my mind: how to
map a 18% point ( or a mid-tone point ) in a 1 to 255 scale in digital
photo file? there are four possible answers i can guess,

1, 255/2 = 128
2, 255*0.18 = 45
3, 0.18^(1/2.2)*255 = 117
4, 0.5^(1/2.2)*255 = 186

which one is right?

Steven Woody, Nov 27, 2007
13. ### Don Stauffer in MinnesotaGuest

On Nov 26, 1:21 pm, "Douglas" <> wrote:
> "David J. Littleboy" <> wrote in messagenews:...
>
>
>
> > "Steven Woody" <> wrote:

>
> >> why 18% gray is in the mid of the full scale of brightness from
> >> darkest to brightest? what's the math behind it?

>
> > While the "logarithmic" answer people have given is correct, it's easier
> > to see if you remember that a one stop difference means a twice the
> > brightness.

>
> > So if you have mid-gray at 18%, you get five (that's all, folks) useful
> > tones on a print: 4.5%, 9%, 18%, 36%, and 72%. If you toss in 0% and 100%,
> > that makes 7 (although you probably won't be able to see the difference
> > between 4.5% and 0).

>
> > David J. Littleboy
> > Tokyo, Japan

>
> Perhaps a usefulness not yet explained or stated is for matching colour. I
> use a white, black and grey card (home made) in the first shot of a scene. I
> use it with the "levels" function of Photoshop and so far (maybe 1000
> frames) it works better than nearly any other post shoot white balance.
>
> I don't believe digital photography has the same use for a grey card as film
> shooters have.
>
> Douglas

I'm too lazy to look it up now, but weren't the definitions for ASA
and ISO speeds based on an exposure just above the toe of the
characteristic curve? I always assumed the 18% value was related to
that.

On the other hand, didn't the ISO for digital speed try to stick as
close to that for film speed as possible?

Don Stauffer in Minnesota, Nov 27, 2007
14. ### John PassaneauGuest

Don Stauffer in Minnesota <> wrote in
news::

> On Nov 26, 1:21 pm, "Douglas" <> wrote:
>> "David J. Littleboy" <> wrote in
>> messagenews:...
>>
>>
>>
>> > "Steven Woody" <> wrote:

>>
>> >> why 18% gray is in the mid of the full scale of brightness from
>> >> darkest to brightest? what's the math behind it?

>>
>> > While the "logarithmic" answer people have given is correct, it's
>> > easier to see if you remember that a one stop difference means a
>> > twice the brightness.

>>
>> > So if you have mid-gray at 18%, you get five (that's all, folks)
>> > useful tones on a print: 4.5%, 9%, 18%, 36%, and 72%. If you toss
>> > in 0% and 100%, that makes 7 (although you probably won't be able
>> > to see the difference between 4.5% and 0).

>>
>> > David J. Littleboy
>> > Tokyo, Japan

>>

stuff sniped

One other reason I've not seen mentioned yet is that it's the level all our
exposure meters, even the ones in our digital cameras are set to "see".
That is if you expose a white or black object with you built in meter, it
tries to give you an expose that will make it 18% gray. So including a gray
card will give you something to set your meter by.

John Passaneau

John Passaneau, Nov 27, 2007
15. ### Steven WoodyGuest

On Nov 27, 11:16 pm, Don Stauffer in Minnesota <>
wrote:
> On Nov 26, 1:21 pm, "Douglas" <> wrote:
>
>
>
> > "David J. Littleboy" <> wrote in messagenews:...

>
> > > "Steven Woody" <> wrote:

>
> > >> why18% gray is in the mid of the full scale of brightness from
> > >> darkest to brightest? what's the math behind it?

>
> > > While the "logarithmic" answer people have given is correct, it's easier
> > > to see if you remember that a one stop difference means a twice the
> > > brightness.

>
> > > So if you have mid-gray at18%, you get five (that's all, folks) useful
> > > tones on a print: 4.5%, 9%,18%, 36%, and 72%. If you toss in 0% and 100%,
> > > that makes 7 (although you probably won't be able to see the difference
> > > between 4.5% and 0).

>
> > > David J. Littleboy
> > > Tokyo, Japan

>
> > Perhaps a usefulness not yet explained or stated is for matching colour. I
> > use a white, black and grey card (home made) in the first shot of a scene. I
> > use it with the "levels" function of Photoshop and so far (maybe 1000
> > frames) it works better than nearly any other post shoot white balance.

>
> > I don't believe digital photography has the same use for a grey card as film
> > shooters have.

>
> > Douglas

>
> I'm too lazy to look it up now, but weren't the definitions for ASA
> and ISO speeds based on an exposure just above the toe of the
> characteristic curve? I always assumed the18% value was related to
> that.
>

what i can remember is the 0.1 plus filmbase + fog density on which
the ISO speed was based.

> On the other hand, didn't the ISO for digital speed try to stick as
> close to that for film speed as possible?

Steven Woody, Nov 28, 2007
16. ### Steven WoodyGuest

On Nov 27, 12:13 pm, Steven Woody <> wrote:
> thanks for all your explains and that actually made me in the way of
> understanding. now, another question poped up in my mind: how to
> map a18% point ( or a mid-tone point ) in a 1 to 255 scale in digital
> photo file? there are four possible answers i can guess,
>
> 1, 255/2 = 128
> 2, 255*0.18 = 45
> 3, 0.18^(1/2.2)*255 = 117
> 4, 0.5^(1/2.2)*255 = 186
>
> which one is right?

any clue?

Steven Woody, Nov 28, 2007
17. ### EALGuest

On Tue, 27 Nov 2007 19:20:58 -0800 (PST), Steven Woody
<> wrote:

>On Nov 27, 12:13 pm, Steven Woody <> wrote:
>> thanks for all your explains and that actually made me in the way of
>> understanding. now, another question poped up in my mind: how to
>> map a18% point ( or a mid-tone point ) in a 1 to 255 scale in digital
>> photo file? there are four possible answers i can guess,
>>
>> 1, 255/2 = 128
>> 2, 255*0.18 = 45
>> 3, 0.18^(1/2.2)*255 = 117
>> 4, 0.5^(1/2.2)*255 = 186
>>
>> which one is right?

>
>any clue?

I don't understand the question. I know "poped" means to make holier,
but what does "in digital photo file" mean? And how is 255 supposed to
relate to a percent?

Ed

EAL, Nov 28, 2007
18. ### Floyd L. DavidsonGuest

Steven Woody <> wrote:
>On Nov 27, 12:13 pm, Steven Woody <> wrote:
>> thanks for all your explains and that actually made me in the way of
>> understanding. now, another question poped up in my mind: how to
>> map a18% point ( or a mid-tone point ) in a 1 to 255 scale in digital
>> photo file? there are four possible answers i can guess,
>>
>> 1, 255/2 = 128
>> 2, 255*0.18 = 45
>> 3, 0.18^(1/2.2)*255 = 117
>> 4, 0.5^(1/2.2)*255 = 186
>>
>> which one is right?

>
>any clue?

Here's a table that might interest you. The two columns
marked "Levels" list the number of levels that fstop
range is divided into; hence, in the brightest zone an
image from 12-bit linear data can have 2048 distinctly
different values for brightness, while in an 8-bit gamma
corrected image there are 69 possible distinct levels in
that zone.

Fstop | Linear Linear Gam.Cor. Gam.Cor. Gam.Cor.
| 12 bit Analog Analog 8 bit 8 bit
Range | Levels Value Value Value Levels
------|-----------------------------------------------
1 | 2048 1.0 1.0 255 69
2 | 1024 0.5 0.72974 186 50
3 | 512 0.25 0.53252 136 37
4 | 256 0.125 0.38860 99 27
5 | 128 0.0625 0.28358 72 20
6 | 64 0.03125 0.20694 53 14
7 | 32 0.015625 0.15101 38 10
8 | 16 0.007812 0.11020 28 8
9 | 8 0.003906 0.08042 21 6
10 | 4 0.001953 0.05868 15 4
11 | 2 0.0009765 0.04282 11 3
12 | 1 0.0004883 0.03125 8 2

The useful dynamic range basically ends when one full
fstop is divided into fewer than 8 values. Hence a
12-bit linear data set has about a 9 stop useful dynamic
range, while an 8-bit gamma corrected data set has about
an 8 stop range. (With fewer than 8 levels the
quantization distortion becomes too apparent, and the
results are referred to as "posterized".)

are going to set the white and the black points of the
"display" (paper or monitor). For example, when
printing on paper with a 5 fstop dynamic range, the
printer would normally be adjusted to make 255 be
"white" and 52 black. The middle zone, 3, would have
values ranging from 100 to 136.

Does "3, 0.18^(1/2.2)*255 = 117" look grey to you?

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>

Floyd L. Davidson, Nov 28, 2007
19. ### Dave MartindaleGuest

Steven Woody <> writes:
>thanks for all your explains and that actually made me in the way of
>understanding. now, another question poped up in my mind: how to
>map a 18% point ( or a mid-tone point ) in a 1 to 255 scale in digital
>photo file? there are four possible answers i can guess,

>1, 255/2 = 128
>2, 255*0.18 = 45
>3, 0.18^(1/2.2)*255 = 117
>4, 0.5^(1/2.2)*255 = 186

#1 would be correct if the file used 8-bit linear coding, but nobody
does that because 8 bits simply doesn't give enough dynamic range or
intensity resolution in the shadow areas. On the other hand, 16-bit
linear coding is sometimes used.

#2 makes no sense to me.

#3 is close to correct assuming a particular exposure (see below). The
nonlinear function y = x^(1/2.2) is how intensity is encoded in video,
in JPEG files, and lots of other places. This is generally not

#4 tells you what you'd expect to find in the image file for a scene
brightness of 50% of peak (e.g. one stop down), not 18%.

You or the camera has a choice of what brightness in the image gets
considered "1.0" and mapped to 255 in the file. Since images have
areas of widely varying reflectance illuminated by different amounts of
light, 255 doesn't necessarily represent "100% reflectance"; it's just
the brightest tone that the camera has decided to handle. So the
"0.18" in this expression is best regarded as "0.18 times peak white in
this photo", not any absolute reflectance.

It's actually more complex, too, because cameras may depart from this
power function in the highlight and/or shadow areas in order to capture
more brightness range at lower contrast in those areas. The "shoulder"
and "toe" in film response does the same thing in chemical photography.

Since the response tends to be more predictable in the midtones, one
good way to expose images in the first place is to adjust the exposure
so that something you have decided is of average brightness (e.g. an 18%
grey card) ends up in the middle of the tonal scale where you've decided
it should be (theoretically 117, but 115 or 120 or even 128 work too).
Exposing so a grey card ends up in the middle of the code value range,
or the middle of the film density range as measured by a densitometer,
is very common.

In the electronic world, it's sometimes more convenient to expose so
that the brightest thing in the scene that you want to preserve
information from ends up near, but not beyond, 255. You can do this
approximately using any digital camera that has a histogram display.
Some cameras also flash or put zebra stripes in areas that were
overexposed in the preview image, which gives better visualization of
what will be recorded correctly and what will be clipped.

Dave

Dave Martindale, Nov 28, 2007
20. ### mirafioriGuest

if you look at a photographic grayscale of 11 steps, the centre mid-gray
(the sixth step) is indicated as 0.7. this is sensitometric density value, a
log value of opacity.
opacity = 100% of illumination upon X% reflected or transmitted light.
if X=18%, then opacity = 100/18=5.5
therefore sensitometric density = log5.5 = 0.74...-round off to 0.7.
hence 18% reflection gray is 0.7 sensitometric density value and is the
mid-gray between the white and black of a grayscale.

"Steven Woody" <> wrote in message
news:...
> why 18% gray is in the mid of the full scale of brightness from
> darkest to brightest? what's the math behind it?

mirafiori, Nov 29, 2007