You are here

Maximize Local Contrast

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!

FX-Foundry/Photo/Enhancement/Maximize Local Contrast...
Like Stretch Contrast, but instead of using the minimum and maximum pixel values from the entire image, uses the minimum and maximum in the vicinity of a pixel to compute its new value. Takes a while to run, but really brings out textures. Result is a Grain Merge layer that adjusts values of the original image.

This filter operates on the visible image, not on a layer or selection.

Radius indicates how wide a pixel's influence is. If you choose too small a value, adjustment will be too localized and the image will look patchy. Larger values take a bit longer to run.

Threshold indicates how many neighboring gray values above and below a value can be treated as the same, in finding minimum and maximum values. Purely a speed trade-off. Using very low values will make it very slow. Too high values will cause visible "steps" in color values. The latest version does not include threshold, but the older version is still available.

"Feather Haloes" helps smooth out haloes around high-contrast areas.

"Keep Min and Max Layers" leaves the intermediate layers in the stack so you can look at them if you're interested.

Update (21 Jul 2009):

  • New algorithm that works right without any compromises for speed. No scaling, no threshold. It does take a bit of time on large images; 45 seconds for a 1500x2000 pixel image on a modern but not especially powerful PC. The full 8-megapixel image took about 3 minutes. Most of the time is spent on grow-selection, so don't be alarmed when the progress meter seems to hang up for a while. There are just two grows and two feathers to do.
  • If you want a speed compromise, I've added Scaledown factor, which will reduce the time spent in selection a lot, but will add some time for scaling the image. There's essentially no loss of quality. Recommended for especially large images.

Updates (13 Jul 2009):

  • SPEED! Mapping of Min and Max is done on scaled-down layers. Now even large images can be done in reasonable time.
  • Feather haloes feature for more reasonable results on high-contrast images and images with big flat areas
  • Layer mask keeps narrow-contrast areas under control

Updates (9 Jul 2009):

  • Fixed the bug that left strange artifacts in the image.
  • Changed radius to work as a % of image size (maximum dimension)
  • Increased feathering and added limits to min and max layers to control haloes around small, high-contrast features
  • Got rid of sample images. Will find better examples.
Code License: 
GIMP Version: 
Scripting Engine: 

Comments

Do you mean you set the value of the pixel is locality set by newVal = pixelVal / (localMax - localMin) ?

So interesting for me, beginning programming  Script-fu, that I like to help if possible. The history of this script seem to be from http://www.flickr.com/groups/gimpusers/discuss/72157620819124120/ : version 0.1, enhance local contrast in black & white version 0.2, add enhance contrast in color, the actual version. Here is the beginning of the code from a slightly different version: ; MinMax, a Gimp script by Roy Johnson ; ; CAUTION : for small image, because takes a lot of time (probably less then a 1000x1000 px, dependent of computer) ;============================================================================== ; History of change : ; Original version 0.1, enhance local contrast in black & white. ; Version 0.2, add enhance contrast in color. ; Version 0.3, add a beginning of error control, test with gimp 2.6.6 ubuntu 9.04. ;------------------------------------------------------------------------- ; Description : ; Create New From Visible ; Desaturate using Luminance ; Create two new copies, one called Min and one Max ; For each gray value, 0 to 255: ; color-select from the desaturated image ; grow selection by Radius parameter (Feather?) ; paste selection in Darken-Only mode on Min ; paste selection in Lighten-Only mode on Max ; Instructions for incolor : ; Take the Base layer and put it above the Contrast Enhanced layer ; Change the Base layer mode to Grain Extract ; Merge down ; Change the Contrast Enhanced layer mode to Grain Merge ; Now it will be an adjustment layer that you can use with your original color image. ; ; There is a thread about this script at http://www.flickr.com/groups/gimpusers/discuss/72157620819124120/ ;========================================================================== ... Updated july 14 2009. Sorry for the lengthly mess I made before, made worse by the fact that there was a mixture of end of line (the 'cr' and 'lf' of Windows with 'lf' of Linux). Now for the new version I consider the above CAUTION, for small image , false. It is a useful tool for photo retouching in GIMP, thank you.
Subscribe to Comments for "Maximize Local Contrast"