Presumably, all of you know the feeling: you spend hours retouching an image, editing it until your fingers are sore, only to find that when you finally try to share it, odd rings appear in the color gradients. These rings are known as “banding” and are simply tonal value demolitions.
Before explaining where these tonal separations come from and how to avoid them, let’s take a look at a small example:
In the background, we have a problematic gradient on the right-hand side, which appears as a staircase in the brightness curve, commonly referred to as banding.
So, how is banding created?
It can be broken down quickly: If there are more pixels than brightness levels, banding can occur.
To understand this, let’s take a look at how a colorful image is put together. A colorful image has three channels: red, green, and blue. Each of these channels has up to 256 levels, resulting in 256 * 256 * 256 different pixel values. These values differ in luminance, hue, or color saturation.
For instance, in our example, the image is black and white with only 256 possible values. The first dot has an RGB value of 78, and the second dot has an RGB value of 28. The distance between them is 450 pixels. In purely mathematical terms, this means 50 steps to 450px, so every 9px, the value should change by one step. This means that in theory, there should be a clean gradient with invisible levels, but that is not the case.
During editing, a lot of back-and-forth pushing was done, making parts of the image lighter in some areas and darker in others. This process changes the usable area, leading to holes in the histogram, which are breaks in the tonal values.
With a tonal correction, I enlarged the used area and marked the holes – so it is more visible:
These holes are breaks in the tonal values, which show up as problematic gradients (=banding).
Problems caused by compression
Problems can be caused by compression as well. To understand why banding can occur when uploading to the web, let’s briefly examine the JPEG algorithm.
- Compression by conversion to the YCbCr color model
Images are not saved as RGB (red, green, blue) channels but as Y-Cb-Cr (luminance, blue-yellow, red-green). The luminance channel is stored in full resolution, while the other two are calculated smaller. So that looks very simplified as follows:
The RGB image is decomposed into a 100% version of the luminance (Y), and a scaled version for each of the red-green color information (Cb) and the blue-and-yellow information (Cr). It has been found that this process saves a lot of data and, at the same time, still looks very good – except for the true banding.
* note: The process is much more complicated, who would like to deal with this, here is more information that we just sweep under the carpet at this point in order not to bore you with subsampling and pixel rearrangements, etc.
The three channels are broken down into blocks, typically first in 8×8 pixels, then smoothed to further reduce tone differences. Since the difference to the previous value is saved instead of the absolute value, data is saved. This process significantly reduces the file size. However, this block formation and smoothing lead to further holes in the color gradient, which make banding more pronounced. The higher the compression, the more pronounced the banding.
I could keep writing for hours, but the decomposition and different scaling, block formation, and pixel-to-tone ratio are the strongest factors in tonal value holes.
With this background knowledge, one can draw an interesting conclusion to the camera:
The higher the resolution and the better the noise performance, the greater the tendency for banding.
What can we do against banding?
To prevent banding, you can already see in the raw conversion if it could tend to banding. Whenever large-scale, smooth gradients take place, it is better to edit in 16-bit. In 16-bit, there are 65,536 possible values available instead of 256 values per channel. During processing, no holes should arise in the histogram.
Before saving as a JPEG, prevent block formation with a slight noise. Noise means more difference between the pixels. We compare an 8×8-pixel area before and after the noise:
As you can see, the individual pixels are now more different from each other, and smoothing will be less successful here – the JPG algorithm has been tricked.
To create this noise, create a new layer and fill it with 50% gray using “Edit -> Fill”. Then create noise with “Filter -> Noise -> Add Noise.” The new layer is placed in the “Soft Light” (subtle) or “Linear Light” (quite visible) blending mode, and the intensity is varied via the layer transparency. Generate this noise at the very end of the workflow, just before saving (first zoom out, then sharpen, then noise).
If you change the order, you either sharpen the noise (and amplify it), or you prevent the noise from being reduced. So, at the very end, just before saving.
How to remove banding?
If you want to remove banding in an already saved image, the process is relatively simple. First, convert the image into 16-bit to get more tonal values. Then apply Gaussian Blur with a radius of 1 pixel. This closes the holes in the histogram. Then again, add your noise on a separate gray layer (e.g. via Camera Raw, that’s the second option). Finally, change the mode to “Soft Light” or “Linear Light” and adjust.
Of course, it’s better to prepare the image in the right way during the raw conversion (correct usage of the color depth) and be very careful with large, soft brushes while editing.
Further tips and tricks:
Converting to 16-bit and then reducing it to the background layer can also help. Jan Wischermann shows those and some more tips here in the following video:
Don’t have enough expertise yet? Check out our blog’s Retouching Techniques section for more content.
Do you have any suggestions, additions, is this post out of date, or have you found any mistakes? Then we look forward to your comment.
You are welcome to share this post. We are very grateful for every recommendation.
Leave a comment