State-of-the-art in BW photo autocorrection?

I have more than 10k nef files from 35mm BW photo negatives. The original negatives were taken over many decades and from quality standpoint are from wall-to-wall: over- and under exposed, contrasty and not so contrasty.

Those raw files should as first iteration be processed to nice positives, preferably with as minimal human intervention as possible.

My plan is to crop photos manually, batch process them with RawTherapee neutral profile and then autocorrect.

Is it possible in autocorrection to do better from RawTherapee Auto Levels or from ImageMagick -auto-level -auto-gamma?


I feel that RawTherapee’s auto exposure gives a good result without much fiddling. Its a good starting place.

@va83 Welcome to the forum! Please provide a sample file, which would help us understand your question better.

Alas, the aforementioned collection is not mine to share, but a good sample is file XAB_0871.NEF from
RawTherapee vs Darktable: invert scanned B&W negatives

It seems that Auto Levels from RawTherapee does not use the full range of available values. Starting with XAB_0871: neutral profile, crop, rotate, negate using RGB Curves, Black-and-White with desaturation, Auto Levels with clip 0% gives min and max values 0.128 and 0.965. Correction with ImageMagick-s -auto-level gives pretty nice result.

I was hoping for usage experiences with other algorithms: CLAHE, sigmoidal-contrast, etc.

Sigmoidal-contrast seems to be especially interesting, as it allows to later restore the original image and to start over. Has someone tried to auto-tune sigmoidal-contrast parameters?

-auto-level isn’t enough because it only stretches to the “full range” and may let you clip the ends to taste (I forget if it is this command that does that or another one).

Check out @snibgo’s site which has plenty of goodies using ImageMagick. If you don’t use Windows, you are out of luck because they are Windows batch scripts and might require some compiling as well. He might chime in since I pinged him. :wink:

My wording was ambiguous :blush:. I wanted to say that notwithstanding the name, the RawTherapee-s Auto Levels actually does not do the auto levels. As i do not know how to do it automatically in RawTherapee, then after saving RT Auto Levels results to intermediate file, the much needed optimization could be reached with ImageMagick-s -auto-level. This command does not clip the ends.

As a very rough first-try, I like ImageMagick “-auto-level -auto-gamma”. This first stretches the values to the full range of 0 to 100%, then applies a power curve that makes the mean approximately 50%.

Instead of “-auto-level”, some people prefer “-normalize” or “-contrast-stretch X%xY%” which give higher contrast but with clipping.

These options are documented at

My page Set mean and stddev gives a method for adjusting the mean and standard deviation (lightness and contrast) of an image without clipping. It works by applying a power and a sigmoidal-contrast (“S”) curve. It finds the parameters for those operations by iteration. For example, the module can be used to process an image to a standard-deviation of at least 0.18 without changing the mean.

The method could be implemented in a script but it would be slow. So I implemented it in C (FLOSS), as an ImageMagick “-process” module. To use it, ImageMagick must be built using process modules.

I show CLAHE at [Adaptive] Contrast-limited equalisation. See also Adaptive auto level and gamma and other pages linked from snibgo’s ImageMagick pages.


I just wanted to pop in and say how much I appreciate your work and that page of info, @snibgo. :wink: awesome resource!


Thanks, @patdavid.

1 Like