Ok, that’s rather easy but what if I have values between 0 and 255. I inserted 255 and 0 for X and X_norm were 1 and 0. Then I  solved the two equations and got 0 for mean and 255 for std. Can that be right?
Thank you very much! The grayscale works perfectly!