maximum contrast using linear gery-level trasformation
If you're subtracting the minimum and stretching the maximum remaining value to be 1, you get the following:

Let $m = \min\{I(x,y)\}$ and $M = \max\{I(x,y)\}$
$$I_{\text{new}}(x,y) = \frac{I(x,y) - m}{M-m} = AI(x,y)+B $$

where $A=\dfrac{1}{M-m}$ and $B = -\dfrac{m}{M-m}$

Hope this clears it up.