Dehaze in GIMP 3.2: a simple, flexible layer effect

Haze removal: easy, flexible, and always adjustable.

GIMP Dehaze filter example. Split-view comparison of a hazy desert mountain landscape: left half shows the original with flat, grey-beige haze; right half shows the same scene after using Dehaze in GIMP, with warmer tones, deeper shadows, and greater separation between the mountains and foreground. Photo © Xiao Li.

Dehaze in GIMP 3.2: a simple, flexible layer effect

Key points

  • A Dehaze filter for GIMP 3.2, non-destructive and fully editable
  • Removes atmospheric haze from outdoor scenes, or adds a haze or fog effect: one filter, both directions
  • Adjusts more strongly where haze is present; nearby subjects change very little
  • Part of the Presence plugin, which also includes Clarity, Texture, and Punch (whites and blacks)
  • Requires GIMP 3.2 or later, on Linux or Windows (macOS isn’t supported)

Non-destructive haze removal with the GIMP Dehaze filter

The GIMP Dehaze filter removes atmospheric haze from outdoor scenes, or adds it when you want more atmosphere and depth. It attaches to a layer as a non-destructive filter, so you can adjust it, turn it off, or remove it entirely at any point.

Here’s a short demo:

Here’s another demo, showing how you can choose a haze colour, as well as rely on the plugin estimating it:

Until now, haze removal in GIMP meant experimenting with curves adjustments, channel work, or hacks. None of them gave you a result that scaled with distance. A proper non-destructive approach wasn’t possible until GIMP 3, when layer effects were introduced. The Presence plugin’s Dehaze filter automates haze reduction, with flexible options you won’t find in other photo editing apps, like Lightroom or Affinity.

The Dehaze filter is built on the gegl-presence project by sandbranch. I built the GIMP interface around it and added enhancements to sandbranch’s underlying image processing.

How does the Dehaze filter work?

Atmospheric haze is caused by moisture, dust, and particles in the air that scatter and absorb light. The further away a subject is, the more washed-out it looks.

The Dehaze filter first finds the haziest part of the image, like washed-out sky near the horizon, and treats that colour as what pure haze looks like. (You can also pick this colour yourself with the dialog’s haze colour picker.) The filter compares the weakest colour in each small patch with that haze colour: the closer they are, the more haze it assumes is there. Then it removes the haze from each pixel in proportion to how much haze it finds, revealing the scene’s haze-free colours and restoring their contrast and strength. Distant, hazy areas get a stronger correction, and nearby, clear areas get almost none.

The Dehaze filter dialog

Dehaze presence GIMP 3 Dehaze filter dialog showing Amount slider at 0, Estimate the haze colour checkbox checked, Output range set to Keep hue, Blending Options expanded with Mode set to Replace and Opacity at 100, and Preview checked.
The Presence plugin’s Dehaze filter dialog

Amount

How much haze is removed (positive) or added (negative). At 0, the image is unchanged. Positive values restore contrast, colour, and depth in hazy areas; the further away and hazier an area, the more it changes. The number is roughly the percentage of haze removed: 50 removes about half, 100 removes all the haze the filter detects. Negative values add haze of the same colour as the haze already in the image, more in the distance. At −100, nearby subjects get a moderate veil and distant areas are almost completely hidden.

Estimate the haze colour

The filter works out the haze colour from the image automatically. Turn it off to use the Haze colour picker instead.

Haze colour

A colour picker that’s visible only when Estimate the haze colour is turned off. Pick from the haziest, most distant part of the image.

Output range

How colours pushed outside the displayable range by a strong positive Amount are handled. Keep hue (the default) corrects out-of-range colours while preserving their hue; Clip each channel keeps as much saturation as possible but hue and brightness can shift; Don’t limit (floating point only) leaves them uncorrected — useful for HDR workflows in 16- or 32-bit floating-point precision. For most images at moderate settings, the difference is invisible, so you can leave it at the default.

Blending options

Mode: the blending mode to apply to the filter. You have all the standard GIMP layer blending modes to choose from.

Opacity: increases or decreases the filter’s effect on the layer.

Preview

Toggle the preview of the filter’s effect on and off.

Merge filter

Apply the filter destructively, not as an editable layer effect. This has no effect on any layer effects already attached to the layer. Not recommended because it’s irreversible.

Split view

Before-and-after view, split down the middle.

How to use the Dehaze filter, step by step

Before you begin: you need GIMP 3.2 or later, and make sure the Presence plugin is installed. Installation instructions are at the end of this post.

  1. In an open image, select the layer you want to apply Dehaze to.
  2. Go to Filters > Presence > Dehaze. The Dehaze dialog opens.
  3. Adjust the controls to taste and click OK. The filter attaches to your layer.
  4. To adjust the effect later, click the fx icon on the layer in the Layers panel. The Dehaze dialog reopens with your previous settings intact.

Some tips:

  • Start with Amount. Increase it to remove haze; a small positive value often goes a long way. Leave the other controls at their defaults first.
  • If the result has an unexpected colour cast, try turning off Estimate the haze colour and pick the colour manually from a hazy patch in the distance.
  • Snow, white walls, and overcast sky can confuse the automatic haze estimate and cause those areas to darken or take on a colour cast. If that’s a problem, manual haze colour selection usually fixes this.
  • To add atmosphere, small negative values give the most natural results. The effect becomes heavy at −50 and very strong at −100.
  • Output range can usually be left at its default. Consider changing it only if you notice colour shifts in the most saturated parts of the image after a heavy positive Amount.

How to apply Dehaze to a selection: built-in masking

To apply Dehaze to only part of the image, make a selection before you open the Dehaze dialog, so it affects only the selected area. And if you edit the layer effect, any adjustments affect only the area that you originally selected. You don’t need to select it again: the layer effect remembers the selection: the layer effect stores the selection as if it were a mask specific to that filter.

More dehaze control than Lightroom, Affinity

Lightroom’s Dehaze is a single slider. Drag it right to remove haze, left to add it. Camera Raw works the same way.

Everything else is decided for you: how the haze is detected, what colour it is, how the result is toned. Adobe hasn’t published the implementation, and they expose none of its parameters to the user. If the result doesn’t suit your image, there’s nothing to adjust. You move the slider and accept what comes out.

Affinity gives you more to work with. Its Haze Removal filter has three sliders: Distance, Strength, and Exposure Correction. Affinity’s Distance control acts like a graduated filter on the haze removal, specifying how far into the scene the haze removal reaches, so moving it right reaches towards the background. Strength sets how hard the filter works. Exposure Correction compensates when the result comes out too dark or too bright.

The GIMP Dehaze filter’s Amount slider works like Lightroom’s Dehaze slider, in both directions. Positive values remove haze; negative values add it.

The Dehaze filter’s Haze colour picker has no equivalent in Lightroom or Affinity. Neither Lightroom nor Affinity enables choosing the haze colour. They just estimate it similarly to how the Dehaze filter’s Estimate the haze colour does.

Those other apps don’t include the clipping prevention that the Dehaze filter provides in its Output range control. In fact, both Lightroom and Affinity can introduce clipping when pushed to extremes.

Blend mode and Opacity in the Dehaze filter extend your control further still. Lightroom just applies dehaze at full opacity in Normal blend mode.

While Affinity’s Haze Removal tool gives you more flexibility than Lightroom, it’s not a “live filter”: it changes the pixels of the layer you apply it to. Once it’s applied, you can’t edit it, so you have to start again. The Presence Dehaze filter is always editable.

Better dehaze quality than Lightroom, Affinity, Capture One: no clipping

The Presence plugin’s Dehaze filter doesn’t clip whites when pushed to an extreme. At 70 or higher, you may see some slight colour changes in clouds, and at 85 or higher those changes become more pronounced. But there’s no clipping even at an Amount of 100. You can fix colour shifts, but not clipping. So those extreme amounts are still usable (with some tweaking).

In contrast, Lightroom, Affinity, Capture One, and other apps all clip whites at higher settings. Presumably, those applications’ developers either didn’t test extreme dehazing amounts or didn’t know how to fix it. In any case, those apps’ dehazing usefulness is limited due to inevitable clipping.

This is a testament to the developer sandbranch, whose GEGL filters prevent Dehaze clipping at any scale. (As mentioned above, the Presence Dehaze filter uses his filters as the engine behind the plugin.)

Traditional haze removal methods in GIMP

Over the years, a few approaches to removing haze in GIMP have been proposed. The approximated a haze removal effect, but none of them truly addressed haze.

Auto White Balance

On specific types of hazy images, using the Auto White Balance tool (Colors > Auto > White Balance) can appear to remove haze. But it’s destructive and not configurable.

Levels

If you see flat areas at the right and left of an image’s histogram, moving the black and white points right and left to the points where the histogram rises and falls can make an image look better by increasing contrast. But this isn’t haze removal, and it affects the entire image, not a gradient from foreground to background.

Curves with Soft Light

This method uses two layers: first duplicate the layer, then on the duplicate layer, use Curves to lower the white point. The image appears washed out, until you change that layer’s blend mode to Soft Light. It’s a convincing effect, but it affects the whole image, not just the background, so the foreground pops (sometimes unrealistically), which probably isn’t what you want.

Unsharp Mask

A popular recommendation has been to use Unsharp Mask with a large Radius and small Amount. The reasoning is that haze is a blurry glow, so subtracting a blurry version of itself should cancel it out. But haze isn’t a blurry glow, an effect on top of the image. Haze is physically in the scene itself: atmosphere between you and the subject scattering light before it reaches the camera. The result is that distant objects lose contrast and colour saturation, their shadows lift toward grey, and everything looks like it’s behind a thin white veil. The closer something is, the less haze affects it. Unsharp Mask tries to counteract blur, but not haze.

Why not use G’MIC dehaze filters?

Because they’re destructive and pretty much unusable.

G’MIC includes two dehaze filters, DCP Dehaze and Simple Dehaze. Both filters’ defaults display unacceptable levels of over-sharpening (crunchiness) and colour shifts. Simple Dehaze appears to work better, but it’s quite aggressive, the controls’ settings values are cryptic/unexplained, and hard to get right. And both are destructive.

Here are two short demos that illustrate the problems with each.

G’MIC DCP Dehaze demo
G’MIC Simple Dehaze demo

An important step required to install the Presence plugin

GIMP processes your image through a library of tools called GEGL operations. They’re behind a lot of the features we use all the time, including filters like sharpen, blur, adjust colour, detect edges, etc. Plugins can be built on top of those operations, combining and controlling them so you don’t have to. The Presence plugin adds Dehaze as an additional filter available to GIMP.

Because of the way GIMP installs new GEGL filters, after saving the Presence plugin to your plugins folder, you must open, close, then reopen GIMP in order for the plugin and its filters to be properly registered. See the installation instructions below.

Good to know

  • The Dehaze filter is one of four filters in the Presence plugin. The others are Clarity, Texture, and Punch (whites and blacks), all installed together.
  • Dehaze works best on outdoor scenes with depth: landscapes, cityscapes, and seascapes. It isn’t designed for indoor scenes or subjects without atmospheric depth.
  • The Presence plugin requires GIMP 3.2 or later.
  • The plugin currently supports Linux and Windows. macOS isn’t supported.
  • The plugin checks for updates automatically. You can also check manually via Filters > Presence > Check for updates.
  • Built-in help explains how the filter works: Filters > Presence > Presence help… 
  • IMPORTANT! When you install or update the Presence plugin, you must open, close, then reopen GIMP for it to be properly registered. Quirky, yes, but that’s just what GIMP requires for this type of plugin.

What languages is the plugin available in?

This plugin is available in the following languages. You don’t have to do anything to see it in your language. GIMP will automatically load the correct version of the plugin (provided you follow the installation instructions below).

  • Nederlands (Dutch)
  • English
  • Français (French)
  • Deutsch (German)
  • Italiano (Italian)
  • Magyar (Hungarian)
  • 日本語 (Japanese)
  • Polski (Polish)
  • Português (European Portuguese)
  • Português (Brazilian Portuguese)
  • Español (Spanish)
  • Українська (Ukrainian)
  • 简体中文 (Chinese (Simplified))
  • 繁體中文 (Chinese (Traditional))

If you have any suggestions to improve those translations, please let me know.

Install the Presence plugin to get the Dehaze filter

This plugin is supported for GIMP 3.2 and later, on Linux and Windows.

If you run into problems with these steps, let me know in the comments below.

IMPORTANT! Before you start:

GIMP processes your image through a library of tools called GEGL operations. They’re behind a lot of the features we use all the time, including filters like sharpen, blur, adjust colour, detect edges, etc. Plugins can be built on top of those operations, combining and controlling them so you don’t have to. The Presence plugin adds Dehaze as an additional filter available to GIMP.

Because of the way GIMP installs new GEGL filters, after saving the Presence plugin to your plugins folder, you must open, close, then reopen GIMP, in order for the plugin and its filters to be properly registered.

1. Download the Presence plugin

presence-gimp3.zip

You’ll extract the .ZIP file as described in the next section.

2. Copy the downloaded .ZIP file to where GIMP looks for plugins

This is something you have to do for every plugin you add to GIMP 3.

Find where GIMP looks for plugins:

  1. Open GIMP if it’s not already open and select Edit > Preferences in the GIMP menu.
  2. In the Preferences dialog, scroll down the list on the left until you find Folders, then click on the expand icon in front of the word.
  3. Scroll down the list of folders and select Plug-ins.
  4. Still in the Preferences dialog, on the Plug-in Folders panel on the right, locate your plugin folder(s). You can use the folder that’s listed for your user name or add a new one.
  5. Click on the “Show file location in the file manager” button to open your computer’s file manager.
  6. Copy the .ZIP file you downloaded into that folder and extract it there. You should see a subfolder named “presence-gimp3”. The plugin is inside that folder (see the note below for why it should be in its own subfolder). Don’t move it, just leave it in that subfolder.
  7. Files downloaded from the internet or transferred across systems may not retain their “executable” flag, especially on Linux. The plugin’s .py file needs the correct permission to be executed as a script. It’s a quirk of the different operating systems’ security models. Windows 11 treats plugin .py files as executable automatically.
    How to make the plugin executable on Linux:
    You should be able to right-click on the .py file and set the permission to allow it as an executable. Or you could set it in your Terminal app with the command chmod +x [PATH TO WHERE YOU EXTRACTED THE PLUGIN FOLDER]/presence-gimp3/presence-gimp3.py. For example, with GIMP 3, I extracted the plugin folder into a subfolder of Documents, so the command would be chmod +x "Documents/GIMP plugins/presence-gimp3/presence-gimp3.py".

There are two files in the presence-gimp3 folder that need to be marked as executable: presence-gimp3.py and helpers.py. Do not mark any other files in that folder as executable.

3. Register the plugin with GIMP

As mentioned above, you MUST open GIMP, close it, then open it again for the plugin to become fully registered with GIMP.

If all has gone according to plan, you should find the Presence menu under Filters, where the Dehaze filter lives: Filters > Presence > Dehaze.

4. Optional: create a keyboard shortcut

If you want to assign a keyboard shortcut for the menu items, go right ahead.

These instructions are the same as for my other GIMP plugins (Interactive luminosity masks, Frequency separation, Dodge and burn…). Only the plugin names change.

Why it’s important to follow these steps

GIMP version 3.x requires every plugin to live in a folder with exactly the same name as the plugin file. (You can see and configure where GIMP looks for plugins in Edit > Preferences > Plug-ins.)

This is an example of how working with free software isn’t entirely free. You have to do some of the work that other systems automate, and put your thinking cap on. Bear in mind that GIMP is developed and maintained by volunteers who donate their time and talents as and when they can. So sometimes documentation lags behind development.

Frequently asked questions

Does GIMP have built-in haze removal?

Not built in. GIMP 3.2 has no native dehaze filter. You can add one with a plugin, such as the Presence plugin’s Dehaze filter or G’MIC’s dehaze filters.

How does dehazing in GIMP compare with Lightroom’s Dehaze?

GIMP has no built-in dehaze adjustment, so you need a plugin. The Presence plugin adds Dehaze as an editable layer effect. In Lightroom, Dehaze is a standard slider.

Both remove haze with positive values and add it with negative ones. The main differences are control and where the adjustment happens. Lightroom estimates the haze colour automatically and gives no way to change it. The GIMP filter can estimate it too, or you can pick it from the image. It also lets you choose how out-of-range colours are handled, and you can set a blend mode and opacity. Lightroom applies Dehaze while it processes the raw file. The GIMP filter works on the layer’s pixels inside your image, alongside your other layers.

Why does Dehaze darken snow, white walls or overcast sky?

The filter assumes clear areas contain some dark pixels. Large bright areas have none, so it reads them as thick haze. Picking the haze colour manually usually helps.

Can I add haze instead of removing it?

Yes. Negative Amount values add haze, more in the distance, less in the foreground.

Why does the result have a colour cast?

The automatic estimate may have picked the wrong area. Turn off Estimate the haze colour and pick a hazy patch in the distance.

Can I change the settings after applying Dehaze?

Yes, through the layer’s fx icon, unless you used Merge filter when you first applied the filter to the layer.

Does Dehaze work on indoor photos or portraits?

No. It isn’t designed for them, because it relies on atmospheric depth.

Can I apply Dehaze on only part of the image?

Yes. Select the area first, then open the Dehaze dialog. Your adjustments appear only inside the selection. When you click OK, the selection is saved with the layer effect as a mask, so you can remove the selection afterwards. If you reopen the layer effect from the layer’s fx icon later, your changes still apply only to that area.

You can also apply the Dehaze filter to an adjustment layer. Read more about adjustment layers here.

Why don’t I see Filters > Presence > Dehaze after installing?

Open GIMP, close it, then open it again. On Linux, also check that presence-gimp3.py is marked as executable.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *