kw: photo essays, lighting, gamma, image editing, low key, high key, key adjustment, gamma adjustment
I was asked to explain gamma in images. There is a mathematical explanation, but not many folks would have a gut-level understanding of the math. Instead I'll describe the concept:
Gamma is the relationship between the brightness of the light at every point in a scene and the numbers used to store each point in a pixel and display it. In an image file, adjusting the gamma of the image raises or lowers these numbers to "brighten" or "darken" the image, while keeping the zero and 100% points fixed.
When the gamma equals 1.0 the relationship between light intensity and the stored values is a straight line. In such a case, when a pixel received half the amount of light compared to the brightest pixel in the image, the number stored for it is 0.5 times the maximum possible number. For most digital images, the numbers range from 0 to 255, so the midpoint is 127 (only integers are used, so the extra half a digit is dropped). When gamma is changed for an image to a number other than 1.0, the relationship becomes a curve. The result is an image that appears brighter or darker, as if the exposure had been different.
Adjusting gamma is different from changing the overall brightness. Raising "brightness" using most image editing software just adds the same amount to every pixel's value, and lowering it subtracts a fixed amount from every pixel's value. Just a little of this may be OK for some images, but a more nuanced approach works better.
This is the "Color Curves" tool in GIMP (a freeware program similar to Photoshop). Moving portions of the straight line that goes from lower left to upper right adjusts the relationship between the values in an initial image and those in an adjusted image.
Note that below the histogram the "Curve type" is Smooth. For simple changes, we can click and drag a point on the line up or down. The program obligingly adjusts the image so we can see the result in real time.
If we drag the center of the line upward, for example, the line changes to a curve passing through that point, showing the change caused by adjusting gamma. Dragging a point not at the center uses a different function, related to gamma but not the same.
The next image shows how the curve looks when the center point is raised a little.
The center point started with a value of 128, seen in the "Input...Output" indicators, and it now has been changed to 160.
The whole line was not shifted as a straight line, but is now a curve that passes smoothly from 0 to the midpoint to the upper right at 255.
In terms of gamma, this raises it from 1.0 to a higher amount. The effect on the picture is to brighten the midrange the most, with less and less brightening towards either end of the histogram.
Next I'll show how the red, green, and blue histograms are affected by this change, and then the image itself and its adjusted version. These histograms were produced using IrfanView:
The images I used are small, only 800 pixels across, so the "before" on the left is jittery, and the "after" on the right is positively seismic! In the portion of the histogram that was stretched the values were shifted, which "pulled them apart", leaving "holes" between. The overall shape of the histograms reveal that the values were all shifted to the right (brighter), stretching the leftward (darker) portion and squeezing the rightward portion.
Next we see first the image I started with and then its adjusted version. The primary visual differences are that more detail is seen in the shadows, the whole shop appears a bit brighter, and there is a little more emphasis on the woman.
The original image was 1,376x768 pixels; these are 800x447. I used a rather short prompt: "The essence of ingenuity with a steampunk vibe", using the Google Flow site, which makes use of the Nano Banana family of art engines for still images. Unless the prompt includes a request for a bright image, or high key, this engine, like all the others I have used, tends to produce medium-to-high contrast, moderately low key (sorta dark) images. Sometimes the image can be quite dark, as we will see.
When I want to adjust gamma only to raise the key of an image, I edit with IrfanView, which has a control to set a numeric value between zero (totally black except those pixels that started out with a value of 255) to 10 (almost totally white). GIMP doesn't use numeric gamma so I don't know the exact value GIMP used for the adjustment I made, but it is probably about 1.2.
Now let's see how gamma adjustment affects images that were deliberately produced at either high key (lots of white) or low key (lots of dark gray and black).
Here is a common treatment of a baby picture: overexposed on a white background. The attached histogram shows that there are very few darker pixels. The slightly dimmer peak at the right is the shadow, barely visible to the left of the baby's head. The "baby pixels" make up the "mountain".
I used a gamma adjustment of 0.75 to bring out more color in the baby's face. Although the shadow is a bit more distinct, I like this picture better overall.
Next, here is a low key example. I have made a lot of images of imaginary caves. This is one of a series I call Spelunker's Paradise, based on a 15-word prompt. While cave imagery tends to be low key, this was the darkest of the bunch. The engine was Ideogram in Leonardo AI. The histogram has a big peak near "black" and not much else, and in the image one can see only hints of the scenery.
I use IrfanView with a gamma adjustment of 1.2 or 1.3 for moderately low key images. In this case more drastic treatment is needed; I first used 1.5:
A lot more is visible. Based on my own spelunking experience, this is probably realistic. However, I also tried a gamma adjustment of 2:
If I were going to print the image for hanging on my dining room wall, this is the version I would use. You can see in the histogram that all but a few of the darkest areas have now been pushed to be brighter than nearly all of the first image. If the gamma were to be raised even higher it would look unnatural.
In all the histograms of gamma-adjusted images, the jitter-to-zero shows that when RGB values were changed to be larger, gaps resulted. The human visual system is very forgiving of small glitches in color. If I wanted to produce an image with strongly adjusted gamma, and still have a smoother color histogram, I would upscale the image 2:1 using Upscayl, adjust gamma, then reduce the result again to the original size. The final image would have a smoother histogram and this would also potentially reduce image artifacts that could show up otherwise.
The key takeaway is that adjusting gamma is like changing the exposure after the fact.

























