Why does my normalization make images darker?

I have written the following function to normalize images to the range [0, 1]:

def normalize(image):
    bn, kn, h, w = image.shape
    image = image.view(bn, kn, -1)
    image -= image.min(2, keepdim=True)[0]
    image /= image.max(2, keepdim=True)[0]
    image = image.view(bn, kn, h, w)

    return image

Unfortunately this makes images darker, as can be seen here:

Bildschirmfoto 2020-12-01 um 18.59.24

Bildschirmfoto 2020-12-01 um 19.03.15

The first one is before and the second one after normalization. How can that be?

The posted images don’t seem to be only normalized but also rotated or cropped, so I’m unsure which transformations are applied on the image.
Could you upload the original image so that we can check it?