How to apply Local Contrast using GIMP?

I use various different open source software programs for image processing. A useful tool found in other programs (than GIMP), for example Rawtherapee (RT) and Darktable DT), is called Local Contrast. It is an operation intended to be applied at the end of pipeline. In that, after using whatever tools the program offers for editing photos (or developing raw files) it can be applied and may improve the result.

I’ve tried to find such a tool in GIMP but have NOT been able to find anything that goes by the name Local Contrast. As a result I’ve done some research to try and learn more about what is really being done to the image with the idea that GIMP may use a different term for the same kind of tool. It appears as though in other programs, such as RT & DT, the Local Contrast tool has similarities to Unsharp Mask which of course GIMP does include. However, for Local Contrast the parameter values are set quite different than for sharpening. In those other programs they have default values for the Local Contrast tool that almost always, at least in my case, make some improvement to the image. Therefore, using it can be a simple as turning it on and off and reviewing the preview image.

Therefore, my first question would be, "is GIMP expecting users to use the filter called “Filter>Enhance>Sharpen(Unsharp Mask)” to perform local contrast adjustments. If so might there be some documentation that informs about how the parameters (Radius, Amount, Threshold) apply to local contrast adjustments.

Note: I am aware that the GMIC Plugin for GIMP includes a tool called “Local Contrast Enhancement” that seems to have characteristics similar those those I’ve found in RT & DT. However, it has effectively become unusable in recent versions of that Plugin because the zoom factor for the preview image must be kept at 100% or more. For my display screen and photos, with more than 50MP, you are limited to previewing a very small portion of the picture and as previously mentioned what I like about local contrast tools is the overall affect.

My recent research has caused me to learn that the parameters used for Unsharp Mask, no matter what program I’m using, are related to overall resolution of the image file being processed. Since I have several cameras that produce files of different resolutions I’m thinking that even default values ought to be adjusted accordingly. Does that make any sense? If so this is another reason for finding some more in depth documentation on what Unsharp Mask is actually doing. Could use some help on that?

Local contrast/clarity adjustments in programs like Photoshop, DT and RT is great. I use local contrast in DT all the time. This post here might have some guidance for you on how to achieve this effect in GIMP.

There might be something here of use:

Unsharp mask: blur the image, subtract from the original (to estimate the effect of blurring that we want to undo), add the result to the original.

Local contrast = large sharpening radius (to compare pixels to the local average, so the surroundings, not just the neighbouring pixels), low amount.

A great summary:

Thanks Terry! I did find that searching the web. It is very interesting but NOT what I’m thinking of as a Local Contrast tool. In that, turn it on and off once you’ve done what you can with other more complicated methods. If it helps leave it on otherwise turn off and call quits.

Thanks Ted, very Interesting effect. Something I should explore. However, per my reply to Terry NOT what I’m thinking GIMP should have available.

Rich, Pat’s piece which you cite is one of the articles I found when searching the web. It did contribute to my reasoning that maybe GIMP developers see Unsharp Mask as equivalent to what other programs refer to as Local Contrast. To fit my desire, I’d need to be able to devise the alternative default values for original parameter settings. If it makes sense to devise different defaults based on image file resolution that would be reasonable.

Maybe GMIC works better online than under GIMP but this is about whether or NOT there is something that works under GIMP.

István, yes this is another article I read which caused me to think that maybe GIMP developers saw no need for a Local Contrast tool given they do have Unsharp Mask. See reply to others for what I’d say is needed to make that work.

If I read the OP correctly, you’re looking for something with suitable default values so’s you can just turn it on or off. If so, please try Filters>Enhance>Unsharp Mask which, with a radius of 3px, is pretty local.

There is also this technique.

1 Like

After all, we have in GIMP the ability to use GMIC, I just illustrated that we have such functionality.


I checked work correctly GIMP 2.10.26 (Win)
also try:

This looks like something I need to learn about but by my way of thinking it does NOT qualify as a substitute for what other image processing programs call “Local Contrast”.

I have used the “Local Contrast Enhancement” tool in GMIC in the past and from my perspective it does fit the bill. However, I want to be able to preview the entire image (for easy comparison purposes) and that no longer works as a result of GMIC (now) not allowing the preview image to be less than 100%.

I also have the impression that GMIC is a complete image processing program of its’ own that is separate from GIMP. Just another example of the various different programs that all have Local Contrast tools when GIMP does NOT.

that is correct

No need to “shout”, we all see your point of view …

This looks to be what I had in mind regarding a different set of presets for the Unsharp Mask (USM) filter to be used when wanting to adjust Local Contrast. However, on my 2.10.38 version of GIMP it does NOT appear to do anything but neither is there any indication of error. It also appears as though the values for Radius and Amount might be based on different units than USM. Reading the comments in the script there is mention of percentages. However, I must admit that what the values represent in USM is NOT clear to me. I do know that when I fiddle with them they do affect the preview image.

1 Like

Thanks but I’m well aware of that article and I did go back and review it prior to creating this post.

Understanding the how to derive parameter values is a good part of the problem. The referenced ChatGPT does NOT, look to me, like it adds anything to what is found in the GIMP User Manual. The Rawtherapee (RT) documentation is even less detailed although it does distinguish between Unsharp Mask (USM) and Local Contrast (LC).

Based on discussion herein as well as various articles that have lead me to believe that USM might also be an LC tool I’ve undertaken an experiment.

Let me start with an example image which came from scanning some old 35mm film. In order to limit the size of the image files I’ve converted them to .jpg format even though I normally work with .tif format in order to preserve original data (i.e., avoid lossy compression).

Note: This original scanned (.tif) file is pretty low resolution (3303 x 2080) when compared with the files I’m normally processing which includes from a camera with a 50+MP sensor.

While NOT entirely significant to this discussion I include the original scanned image mostly to demonstrate why I’m so fond of GIMP as follows:

Now compare that with what results from doing nothing more than applying GIMP’s Auto Levels tool as follows:

Next is the result of applying the USM filter using the default setting to the sample produced using Auto Levels as follows:

Next is a result processing the Auto Levels .tif file with RT and applying nothing but LC as follows:

Next is a result of processing the same Auto Levels .tif file with GIMP and applying the USM filters with parameter values intended to comply with advice regarding how to achieve LC as follows:

My observation is that GIMP’s default USM parameter settings did NOT produce any significant change. However, the use of RT LC produced a minor change in appearance that I find desirable and is consistent with what I often experience with LC tools. Finally, it is hard to tell the difference between the result from RT LC and my experimental result using the GIMP USM filter.

Now, back to the question about how to derive parameters. The GIMP USM filter allows Radius to range from 0 to 1500 with the default value set to 3. I’d call that a pretty low value given the range which begs some questions as follows:

  • What conditions would call for using the 1500 value?
  • Given that it is pixels might it be that taking resolution into account is warranted?
  • The Pop-Up guide says “Expressed in Standard Deviation”. Can some elaboration on what that means be found somewhere?

When it comes to Amount the GIMP USM filter allows a range of 0 to 300. The default value of .5 (yes I think that is one half) is similarly a pretty small value considering the range with questions as follows:

  • One half of what?
  • What conditions would call for using the 300 value?
  • Should resolution be considered when setting this value?

When it comes using USM for making LC adjustments the articles I’ve reviewed suggest increasing Radius and reducing Amount from the values normally used for sharpening. As result I set the values for the GIMP-USM-LC version of the above picture as follows:

  • Radius = 100
  • Amount = .2 (2 tenths)

As it turns out the documentation provided with GIMP is better than what is provided with RT. In case anybody cares. The LC tool in RT allows Radius to range from 20 to 200 and Amount from 0 to 1.0. The example picture (above) used the default values as follows:

  • Radius = 20
  • Amount = .2 (2 tenths)

That’s it for now. Sorry about the amount of verbosity but if you made it to here many thanks for your attention. I’d be most grateful for answers to the questions. That could include references to documentation that focuses on the subject.