Relation between histogram equalization and 'Auto Levels' I need to enhance an image using only global linear adjustment of intensity, i.e.:

$$I'=aI+b,\qquad a,b\in \mathbb{R}$$

where $I$ and $I'$ are input and output (enhanced) image.

I already know how to determine best values of $a,b$ through histogram stretching given the minimum and maximum intensity within image. However, this will not work on the following image. I have added black and white pixel (in red circle):



The image already contains values 0 and MAX, further histogram stretching is not possible.

However, I tried "Auto Levels" feature in Paint.NET software  with the following result:



Looking on the dialog window, there is some extra factor that affects overall histogram shape (number in the middle right part):



Is this an additional scaling factor? Or it is some parameter of non-linear transform?

How is is determined?
From the paint.NET manual, the parameter in the middle is a gamma correction, which can be used to enhance the contrast in the dark tones or high tones. The gamma-curve is the simplest non-linear level transfer curve. A more sophisticated non-linear technique for automatic level adjustment is histogram equalization, which consists in applying a monotonic, non-linear map to the image, so that the CDF of the resulting image is linear.