# GIMP/Brightness & Contrast
## Concepts

Very few photos from the camera will have perfect brightness/contrast and most can benefit to some degree with modifications in Gimp. Most do not realize how powerful these adjustments can be in making your photo look professional and to give it that extra pop. An exact description of all the gimp tools discussed below would go beyond the scope of this tutorial and the focus will be more on concepts or why the tools have meaning. If you need more details of how these tools work, it is suggested to read the official Gimp manual.
Some adjustments are more artistic, subjective and there are trade-offs. Contrast gives an image depth, but too much contrast can hide important details in the shadows and highlights. But sometimes this is ok if it contrasts well with your target subjects. Generally speaking, most brightness/contrast issues come about from shooting in the direction of the sun in which you'll get strong shadows AND highlights which are difficult to fix without the advanced techniques discussed below. A digital camera is not psychic and doesn't know the perfect exposures for each sub-element of your photos while maintaining overall brightness/contrast, so it does make a lot of mistakes.

## Refinement Techniques

Note, while some of these techniques work as advertised, some of them "go too far". Below are some nice ways to "throttle down" or refine the effects and to obtain satisfactory compromises.

### Layer Transparencies

Put your corrected layer on top of your original layer. Slide the transparency from 100% left until you obtain a satisfactory result.

### High Bit Depth

Gimp 2.8 only supports 8bit channels. This is very notable for those of us interested in color correction, for even if our original image was only 8bit, 16bit operations dramatically reduce rounding errors. This shows up as lost data/details and gaps in the histogram, especially with repeated operations and layering. To get around this, you may want to use Gimp 2.9 or G'mic from the command line.

### Using HSV Protection Layers

Each image can be subdivided by Hue (which color), Saturation (how far from black & white it is) and value (or brightness). If for example, you only want to adjust the brightness with levels, you can duplicate your base layer. An original saturation layer on top will preserve the base saturation. A Hue layer wil preserve the original hue. The 'color' blend mode will preserve hue AND saturation, which will ensure only the brightness will change.

## General Techniques
### Menu > Colors > Brightness-Contrast

The basics. Not a bad place to start but often too all or nothing (too much collateral damage).

### Menu > Colors > Levels

A step more advanced than Brightness-Contrast. Often sufficient for most color correction issues especially hazy or white balance problems. You picture, pixel by pixel is displayed as a histogram with the brightest pixels to the right and the darkest too the left. Oftentimes, your picture will not use the full brightness spectrum it should be using (flat looking pictures). The cure is to move the black triangle to the right until they get to the edge of your histogram mountain range (or usually just a little into the histogram). Then move the white triangle (brightest pixels) to the left until it connects with its mountain range. Lastly move the grey triangle (in the middle) around until your midtones look right.
Note, that you can perform "normalization" on the individual color channels using the same principal which can be a nice way to correct for color casts.
The downside with levels, is it is often too all or nothing for brightness/contrast correction.

### Menu > Colors > Curves

Another step more advanced than levels. This allows you to do everything levels can but over more points. Generally speaking, you want to sample a part of the picture you want to correct. Then adjust the curve accordingly (keep it somewhat smooth). Despite the level of control here, this too can be too all or nothing and many pictures will benefit from more complicated correction methods.

### Menu > Colors > Normalize

This will stretch the histogram to destroy deadspace to provide nice white balance and won't destroy any color data. This is usually very safe and a precursor to other operations...but oftentimes it is too passive.

### Menu > Colors > Auto > White Balance

Unlike normalize, this will chop weak data to provide a nice white balance. Sometimes this works well, but sometimes it doesn't. It also corrects color as well. I believe this is the same operation as Colors > Levels > Auto. Generally speaking I prefer manual levels over the auto functions unless I need to do batch operations (one of the major gimp batch plugins supports auto levels).

### Using Selections

In truth, your picture is really composed of many subpictures each with their own individual needs for color/brightness/contrast correction. A good trick is to only selection the subject you want to color correct for. e.g. You take a picture of a raft in bright sunlight. The rafters are hidden in the shadows and way under-exposed, while the sky and sections of water are way over-exposed. Doing brightness correction on the whole picture will no doubt make a mess of the water and surroundings. But if you select the raft and its occupants first, you can achieve very exact and satisfactory corrections to reveals the subject without washing out the surroundings. The downside is that making exact selections can be tricky and time consuming.

### Duplicate Layers & Blend Modes

By duplicating your layer and applying varying blend modes, you can achieve powerful effects.
The 'light section' will generally with a duplicate make the image brighter:
* Screen
* Dodge (stronger)
* Addition (strongest)
The 'dark section' will make a duplicate layer on top darker.
* Multiply
* Burn (strong)
The 'contrast section' will (with duplicates) make the darks darker and the light lighter (add contrast, unless the image is inverted but that is a later story):
* Soft Light
* Overlay (stronger...most common blend mode for photo enhancement)
* Hard Light (strongest)
A technique for strengthening this effect is to use many duplicate layers. Two duplicate layers set to overlay provide more contrast than just one.
A technique for weakening these effects is to use partial transparencies (right below the layer mode)

### Overlay Contrast Layer

One of the more simple and common ways to give your image pop. Duplicate your layer and set the top layer to overlay. This will provide more contrast and can give a nice look. You may want to insert a control layer on top to protect saturation (duplicate base layer, move to top and set to saturation in blend mode). This technique will not work well if you have underexposed shadows and over-exposed highlights as they will exaggerate the problem.

### Using blended Black or White Layers

Inserting a solid black, white or sometimes grey layer can be a nice component in brightness correction.
* Insert a white layer and set the transparency to be 50% to brighten the layer (or black layer to darken)
* A white layer set to overlay will brighten the image with an emphasis on brightening the brights.
* A dark layer set to overlay will darken the image with an emphasis on darking the darks.

### Contrast Mask

The idea of a contrast mask is to reduce blown out areas while simultaneously brightening under-exposed shadows. This is a very effective technique for a lot of amateur outdoor shots. If your picture doesn't have shadow/highlight issues, this can unfortunately make a picture look less 3d and more flat (you are reducing contrast after all).
* Manually. Duplicate your layer. Select the top layer. Desaturate (using luminosity). Invert. Filters > Blur > Gaussian Blur (I like radius of 10px). Official Tutorial. Normally overlay increases contrast, but because the image is inverted, the opposite happens.
* FX foundry > Photo > Enhancement > Contrast Overlay (I like blur = 10 and opacity = 100%)

### Luminosity Mask

This is a very high-profile technique used by nature photographers. The gist is that you sub-divide a picture into say 2-5 selections based on lightness. You then perform curve corrections separately on each selection or mask. Great way to protect say a sky while adding that detail back into the shadows. A good conceptional (albeit Photoshop) background on Luminosity Masks can be found here.
* You can obtain tonal regions using thresholds and layer masks
* You can generate luminosity masks using the "Luminosity Masks" plugin. This only gives you three masks though and the expand/contract tool is not intuitive.
* Menu > Filters > G'Mic > Enhancement > Mask Creator. Sees quite powerful, but is difficult to understand. Example and some background here.
* Manually desaturate/invert/difference. Nice but only gives you three tonal layers. Example.

### Tone Mapping

This reduces global contrast while increasing local contrast. This is oftentimes perfect! Example, I take a picture in the woods...normally the sky is overexposed and the trees underexposed. This balances the sky and gives it a nicer darker blue. Then it brightens the forest flow, but keeps and enhances local contrast so say the bark on the trees really stands out.
* Advanced Tone Mapping Plugin: Link. Very nice. Similar effect to a contrast mask...but perhaps doesn't recover as much detail from the shadows and doesn't add as much in saturation.
* Manual Technique. YouTube Video Good results with strong saturation. Is tweakable.
** Make two copies
** Top Copy, Desaturate (luminisot)
** Top Copy, Invert
** Top Copy, Filters > Blur GaussianBlur (10px)
** Top Copy, reduce layer opacity to 65%
** Merge top two layers
** Use new hybrid layer on top to soft light
** Throttle by using the opacity slider
* G'Mic has a nice one. G'Mic > Colors > Tone Mapping (lots of options)

### Menu > Filters > Eg > Shadow Recovery

Simple technique for adding detail to underexposed shadows

### Using Mid-tone Selection Layers

This protects the extreme darks/lights while performing contrast operations on the midtones (most apt to be your subject).
* Duplicate your pictures
* Auto normalize (mild but safe white-balance)
* Right click top layer and create new layer mask from grey scale version of that layer. Edit the layer mask with curves to give it a pulse shape (0->255->0). This will now only select the midtones of your top layer. Now select the top layer itself (not the mask) and play with levels/curves. You can now increase the contrast of the midtones safely. This is a poor man's luminosity mask.

### Border Average Trick

* Duplicate
* Colors > Info > Border Average (3,4 as options)
* Colors > Color to Alpha
* Overlay (try 50% opacity)

### S Curve

This is basically a technique to improve contrast using curves and is similar to duplicating a layer and setting that to overlay. Go to Colors > Curves. Place one point in the middle of the slope. On the right half, put another point half way to the end (1/4 the total distance). Then place a point in the first forth of the line. Drag the point on the far right to boost the highlights. Then drag the point on the far left side down to boost the shadows. This boosts overall contrast, but can can damage already exaggerated shadows/highlights and will not provide localized contrast. Still, not a bad trick for a picture taken in good tonal range.

### HDR

The premise is that you take two pictures of the same scene and use the good brights from one picture and the good shadows from another. As many digital cameras fail to produce adequate tonal range especially in sunny conditions, this can be a great trick if the photos were taken with different brightness settings. You can effectively get the best of both worlds. The first trick is to make sure the two images line up exactly (you can use partial transparencies of your top layer to achieve these). Once they line up, you in essence delete the bad section off of the top layer using a standard selection (many ways to do this). A nice way to do this is with a tone mapping (see plugins above for ways to get nice tonal selections). If you google the subject you'll find a number of plugins and tricks that can help you with the process. If you only have one picture you can still perform a "poor man's" HDR using a contrast mask (or tone mapping mask).