Gamma correction question

J

Jack Frillman

It is my understanding that Gamma correction is for adjusting the color
balance of an image to compensate for the non-linear response of a
monitor. If the purpose of my scanning is to make photo quality prints
do I have to take out the gammma correction when saving the image to the
file that will be used to make the print? Or is the gamma correction
not saved in the file and is only applied by the scanning or processing
software such as Vuescan or GIMP when viewing the image?
 
J

Jim

Jack Frillman said:
It is my understanding that Gamma correction is for adjusting the color
balance of an image to compensate for the non-linear response of a
monitor. If the purpose of my scanning is to make photo quality prints
do I have to take out the gammma correction when saving the image to the
file that will be used to make the print? Or is the gamma correction
not saved in the file and is only applied by the scanning or processing
software such as Vuescan or GIMP when viewing the image?
It is only applied to the data which is sent to the graphics card.
Jim
 
W

Wayne Fulton

It is my understanding that Gamma correction is for adjusting the color
balance of an image to compensate for the non-linear response of a
monitor. If the purpose of my scanning is to make photo quality prints
do I have to take out the gammma correction when saving the image to the
file that will be used to make the print? Or is the gamma correction
not saved in the file and is only applied by the scanning or processing
software such as Vuescan or GIMP when viewing the image?


No, gamma is correctly added to all images for all purposes, done at the
source of the image (digital cameras, video cameras, scanners, etc).
Printers are also non-linear and also need gamma, a little less than a CRT
perhaps, but the printer drivers know how to respond correctly to the
standard image gamma. Printers simply understand that all images are
expected to have normal gamma, and you will get very dark images without
it.
 
B

Bart van der Wolf

Jack Frillman said:
It is my understanding that Gamma correction is for adjusting
the color balance of an image to compensate for the non-linear
response of a monitor.

It's more a correction of brightness than color (although it can be
used for some non-linear color characteristics of the capture device).
The simple gamma correction wraps several adjustments into a single
parameter. It adjusts for monitor response (typically gamma=2.5),
additionally for eye response (complex response depending on average
local luminance level), and it benefits encoding accuracy in a small
number of bits.
If the purpose of my scanning is to make photo quality prints
do I have to take out the gammma correction when saving the
image to the file that will be used to make the print?

No, the data is (~inverse) gamma adjusted before saving to file.
Or is the gamma correction not saved in the file and is only
applied by the scanning or processing software such as
Vuescan or GIMP when viewing the image?

All devices have a response which requires data that is already
adjusted to a known gamma. The scanner (CCD) essentially collects
linear gamma data, and the quantized film transmission data can be
easily accomodated within the 16-bit/channel file. However, all
subsequent output devices in the imaging chain have their specific
non-linear luminance response, and so does the human eye that views
the output. One can correct those non-linearities with a single
inverse non-linear correction, and it can be reasonably well done with
a simple gamma (power) function. This all will allow to encode the
source data with minimal losses in luminance resolution, and do this
with a minimum of bits, if the data is saved to file after gamma
adjustment.

Bart
 
C

Chris Cox

Jack said:
It is my understanding that Gamma correction is for adjusting the color
balance of an image to compensate for the non-linear response of a
monitor.

That is incorrect.
Gamma encoding is done to maximize the efficiency of the encoding
(making the best use of the bits).

See http://www.chriscox.org/gamma for details.
(yes, it's a little out of date. But still right.)

If the purpose of my scanning is to make photo quality prints
do I have to take out the gammma correction when saving the image to the
file that will be used to make the print?
No.

Or is the gamma correction
not saved in the file and is only applied by the scanning or processing
software such as Vuescan or GIMP when viewing the image?

The gamma encoding is baked into the bits of the image.
But you convert the image to the printer color space when printing -
and that adjusts the values from the image encoding to what is needed
for the printer.

Chris
 
A

Alex Stols

Chris Cox said:
That is incorrect.
Gamma encoding is done to maximize the efficiency of the encoding
(making the best use of the bits).

See http://www.chriscox.org/gamma for details.
(yes, it's a little out of date. But still right.)



The gamma encoding is baked into the bits of the image.
But you convert the image to the printer color space when printing -
and that adjusts the values from the image encoding to what is needed
for the printer.

Chris

Is it better then to let the scanner convert the 16 bits data to
gamma 2.2 and output this, than to have the 'linear' 16 bits output?
Or is there any advantage in processing the 16 bits linear file in
Photoshop? E.g. to get more details out of the highlights or shadows.
 
M

Mike Engles

Jack said:
It is my understanding that Gamma correction is for adjusting the color
balance of an image to compensate for the non-linear response of a
monitor. If the purpose of my scanning is to make photo quality prints
do I have to take out the gammma correction when saving the image to the
file that will be used to make the print? Or is the gamma correction
not saved in the file and is only applied by the scanning or processing
software such as Vuescan or GIMP when viewing the image?


Hello

This link gives a pretty good description of what the process is.

http://www.w3.org/TR/PNG-GammaAppendix.html

Mike Engles
 
K

Kennedy McEwen

Jim said:
It is only applied to the data which is sent to the graphics card.

NO! Gamma is normally applied immediately to *all* images irrespective
of their ultimate destination. Try printing raw images which have no
gamma correction or setting the gamma of your camera/scanner to 1.0 and
see where that gets you with your prints.
 
K

Kennedy McEwen

Chris Cox said:
That is incorrect.
Gamma encoding is done to maximize the efficiency of the encoding
(making the best use of the bits).

See http://www.chriscox.org/gamma for details.
(yes, it's a little out of date. But still right.)
It also contains a major error in the third paragraph. Human lightness
sensitivity has a gamma of around 0.3-0.4, *not* 2.0-3.0: you seem to
have the inverse of gamma here.

The concept is, as you describe in your document, that the product of
the eye and display gammas should approximate unity so that linear grey
ramp signals sent to the display *appear* as linear ramps with evenly
spaced steps. If the eye gamma were between 2.0 and 3.0 then we would
need to design displays with gammas of 0.3 to 0.5 to make optimum use of
digital data.
 
M

Mike Engles

Alex said:
Is it better then to let the scanner convert the 16 bits data to
gamma 2.2 and output this, than to have the 'linear' 16 bits output?
Or is there any advantage in processing the 16 bits linear file in
Photoshop? E.g. to get more details out of the highlights or shadows.


Hello

If you want to apply a precise inverse gamma to the image, you will have
to do it in the scanner, as Photoshop curves does not have precise
curves. Photoshop levels will apply a inverse gamma using the middle
box, but in my experience you will end up with darker shadows than if
you used the scanner. In one sense as long as you ALWAYS work in 16 bit
when tweaking a image, it does not matter. The idea is to use all the
tools to make the image look good to you, without creating posterisation
artifacts. You could apply a precise inverse gamma in the scanner, but
any further tweaking using levels or curves or any other tool will give
the image a unknown effective gamma, but it should look good, that is
the point. Don't do much tweaking in 8 bit, it will damage the image.

You do need to calibrate your monitor and set a correct black point.

Mike Engles
 
M

Mike Engles

Jim said:
It is only applied to the data which is sent to the graphics card.
Jim


Hello

Technically you could apply all the inverse gamma correction to the
display. You could then scan and work in linear and store in linear. You
had better be working in more than 12 bits or you will damage your
image.

The problem will come when you send someone your image. Unless they have
also applied all correction to the CRT, you WILL have to apply inverse
gamma to the transported image. You WILL have to apply some inverse
gamma to the image in order to print it, because that is what the
printer WILL expect.

That is why inverse gamma is generally applied at the scanning stage,
the image is compensated rather than the CRT. In order for us to work
linear,the whole world will have to to the same.

Mike Engles
 
A

Alex Stols

Mike Engles said:
Alex Stols wrote:
Hello

If you want to apply a precise inverse gamma to the image, you will
have
to do it in the scanner, as Photoshop curves does not have precise
curves. Photoshop levels will apply a inverse gamma using the middle
box, but in my experience you will end up with darker shadows than if
you used the scanner. In one sense as long as you ALWAYS work in 16
bit
when tweaking a image, it does not matter. The idea is to use all the
tools to make the image look good to you, without creating
posterisation
artifacts. You could apply a precise inverse gamma in the scanner,
but
any further tweaking using levels or curves or any other tool will
give
the image a unknown effective gamma, but it should look good, that
is
the point. Don't do much tweaking in 8 bit, it will damage the
image.

You do need to calibrate your monitor and set a correct black point.

Thank you Mike Engles,

I suppose the whole matter is not so difficult as it appears seeing
all the questions posted here again and again. If only a good and
clear tutorial is available and read by us, beginners.
thanks for the link in your other response.
 
K

Kennedy McEwen

Mike Engles said:
Technically you could apply all the inverse gamma correction to the
display. You could then scan and work in linear and store in linear. You
had better be working in more than 12 bits or you will damage your
image.
There are some consequences of such a workflow in terms of the effects
of any filters that you may wish to apply in Photoshop. In effect, by
working with gamma corrected data you are working in (almost) linear
perceptual space, so the filters apply as expected. However, if you
work with linear data then the filters can be completely different, with
their perceived effect varying across the image as determined by the
local density. The only person that I am aware of who promotes working
in a linear space is Timo Autiokari, whose views on this topic seem to
be at odds with almost everyone else in the image editing business.
 
C

Chris Cox

Mike Engles said:
Hello

Technically you could apply all the inverse gamma correction to the
display. You could then scan and work in linear and store in linear. You
had better be working in more than 12 bits or you will damage your
image.

The problem will come when you send someone your image. Unless they have
also applied all correction to the CRT, you WILL have to apply inverse
gamma to the transported image. You WILL have to apply some inverse
gamma to the image in order to print it, because that is what the
printer WILL expect.

That is why inverse gamma is generally applied at the scanning stage,
the image is compensated rather than the CRT. In order for us to work
linear,the whole world will have to to the same.

No, not if you embed a profile and use a color managed application.
And no, the gamma encoding is not applied for the CRT.

Chris
 
C

Chris Cox

Is it better then to let the scanner convert the 16 bits data to
gamma 2.2 and output this, than to have the 'linear' 16 bits output?
Or is there any advantage in processing the 16 bits linear file in
Photoshop? E.g. to get more details out of the highlights or shadows.

With today's scanners there is no advantage (and some significant
disadvantage) to using linear data.

Chris
 
T

Timo Autiokari

Jack Frillman said:
It is my understanding that Gamma correction is for adjusting
the color balance of an image to compensate for the non-linear
response of a monitor.

Yes, inverse gamma is applied because the CRT monitor will apply gamma
2.5. The human vision requires linear light (like it is in the real
life) so the overall tonal reproduction curve (from scene luminances
to the luminances on the media) must be linear.
If the purpose of my scanning is to make photo quality prints
do I have to take out the gammma correction when saving the image
to the file that will be used to make the print?

No, but you (or the printer driver) should convert the image data from
the color-space it is to the color-space of the printer.
Or is the gamma correction not saved in the file and is only
applied by the scanning or processing software such as Vuescan
or GIMP when viewing the image?

That depends on the software and color-management strategy that you
use. E.g. my linear workflow is such that the system monitor is
calibrated to gamma 2.5 space and my RGB working-space (as well as the
working grayscale -space) in Photoshop is linear. In this case the
image data is and stays linear and the gamma compensation is applied
by the CMS, only for viewing. A bit mode detailsed explanation is
here: http://www.aim-dtp.net/aim/techniques/linear_raw/index.htm

Editing non-linear image data severely damages the image quality, pls
see some demonstrations here:
http://www.aim-dtp.net/aim/evaluation/gamma_error/index.htm this btw
is the sole reason why e.g. the AdobeRaw conversion tool (like most if
not all scanner drivers) apply the enhancing operations on the linear
data.

Timo Autiokari http://www.aim-dtp.net
 
M

Mike Engles

Kennedy said:
There are some consequences of such a workflow in terms of the effects
of any filters that you may wish to apply in Photoshop. In effect, by
working with gamma corrected data you are working in (almost) linear
perceptual space, so the filters apply as expected. However, if you
work with linear data then the filters can be completely different, with
their perceived effect varying across the image as determined by the
local density. The only person that I am aware of who promotes working
in a linear space is Timo Autiokari, whose views on this topic seem to
be at odds with almost everyone else in the image editing business.
--
Kennedy
Yes, Socrates himself is particularly missed;
A lovely little thinker, but a bugger when he's pissed.
Python Philosophers (replace 'nospam' with 'kennedym' when replying)


Hello

I have actually tried to work linear. The main problem is that
Windows/Photoshop looks dreadful when run at gamma 1.0. Try as I might I
can never get it to look right. Also it is difficult to set a
blackpoint, I cannot get my monitor to go black enough. The whole screen
looks harsh.

You are right about how filters, particularly unsharp mask works. In
linear it results in a slight blocking of shadows, but the high end
sharpening is better and the onset of haloes is much later than when
applied in gamma space. This is because the sharpening is applied
equally aroung middle 128 in linear and much higher in gamma space.
I have done the experiments,but really cannot make up my mind about
which I like. It sems to depend on the image.

At the moment we are combinging all sorts of correction at the same time
and not necessarilly the right ones, but it is easy to use.

To me it makes sense to correct for the CRT and perceptual viewing,
separately from correction for printing.

Of course there is now a whole edifice of current practice that makes
linear working possible or easy.

One new sign is that the new Adobe Raw works ostensibly in linear, in
the sense that no specific inverse gamma is applied, but by using the
tools a gamma corrected image is passed on to Photoshop. I like that
approach. If you have Photoshop CS, you can experiment with RAW images
from http://www.sigmaphoto.com/html/Cameras_sd9.htm

I don't work in linear, because it is too difficult to do at present and
I am also somewhat lazy.

It is a good idea for people to experiment. One can learn quite a lot
about the whole process.

Mike Engles
 
K

Kennedy McEwen

Mike Engles said:
I have actually tried to work linear. The main problem is that
Windows/Photoshop looks dreadful when run at gamma 1.0. Try as I might I
can never get it to look right. Also it is difficult to set a
blackpoint, I cannot get my monitor to go black enough. The whole screen
looks harsh.
Because the shadows are heavily compressed.
You are right about how filters, particularly unsharp mask works. In
linear it results in a slight blocking of shadows, but the high end
sharpening is better and the onset of haloes is much later than when
applied in gamma space. This is because the sharpening is applied
equally aroung middle 128 in linear and much higher in gamma space.

The onset of haloes occurs at much heavier degrees of filtration on
highlights because the data is then compressed in the highlights when
gamma is finally applied.
I have done the experiments,but really cannot make up my mind about
which I like. It sems to depend on the image.
That is the problem - the filter isn't being applied perceptually, so it
depends heavily on the image content what the results are.

Incidentally, after our previous discussion on gamma I was a little
concerned that you seemed to remain unconvinced of the quantisation
issue and that I was not explaining what was happening very well. I
have thought about this a bit more and, I think, I have a graphic which
explains it fairly succinctly. Basically it is an extension of your own
curves diagrams, with the key addition of quantisation points on each of
the gamma curves as they are applied to linear data. I can send you a
copy if you are interested. The effect is quite clear, at least to me,
but it would be interesting to know if it makes it any clearer for you.
 
B

Bart van der Wolf

SNIP
Basically it is an extension of your own curves diagrams, with
the key addition of quantisation points on each of the gamma
curves as they are applied to linear data.

Yes, that is usually an eye-opener. It can be easily created in e.g.
an Excel spreadsheet, and the graph can be copied and pasted in e.g.
Irfanview. It might be useful if someone could make it available
through a web link (with your permission of course, unless it is
another homebrew variety).

Bart
 
M

Mike Engles

Kennedy said:
Because the shadows are heavily compressed.


The onset of haloes occurs at much heavier degrees of filtration on
highlights because the data is then compressed in the highlights when
gamma is finally applied.

That is the problem - the filter isn't being applied perceptually, so it
depends heavily on the image content what the results are.

Incidentally, after our previous discussion on gamma I was a little
concerned that you seemed to remain unconvinced of the quantisation
issue and that I was not explaining what was happening very well. I
have thought about this a bit more and, I think, I have a graphic which
explains it fairly succinctly. Basically it is an extension of your own
curves diagrams, with the key addition of quantisation points on each of
the gamma curves as they are applied to linear data. I can send you a
copy if you are interested. The effect is quite clear, at least to me,
but it would be interesting to know if it makes it any clearer for you.
--
Kennedy
Yes, Socrates himself is particularly missed;
A lovely little thinker, but a bugger when he's pissed.
Python Philosophers (replace 'nospam' with 'kennedym' when replying)

Hello

Yes send me the image or give me a link.
(e-mail address removed).

I did as you suggested and applied a inverse gamma to a 8 bit linear
gradient I made in XARAX. Photoshop make a one with a curious shallow U
shaped histogram.

Of course it shows that there are no longer 256 codes, only about 160.
The same effect when I applied inverse gamma by writing in the gamma to
my Matrox video cards registry. That is why we both agreed that for 8
bits we need to apply inverse gamma before the A/D and I think we agreed
that almost no devices did that. Inverse gamma or any kind of processing
to any 8 bit image just damages the image,but we still need to apply the
gamma to a 8 bit lineasr even if the image is damaged, in order to see
it.
It did not prove to me that we need in every case to apply a extra
inverse gamma for perceptual reasons.

That is why I looked up the link for gamma from the PNG group. That does
in very few words make the case for extra inverse gamma beyond
measurable linearity, depending on the viewing conditions. That really
made sense. Of course even if we did work in linear, we would still have
to apply at least inverse 1.8 in order to print the image. We now just
do the whole thing at the scan.

It is a idle speculation, but what kind of work practice would we have
now if in the beginning inverse gamma was applied to the TV,rather than
the TV signal? All perceptual corrections would have been done to the
TV. We would then be working in linear and applying a transform when
exchanging data for printing.

Mike Engles
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top