Why does every image range from [0,255]

I am somewhat new to image preprocessing and CNNs and was wondering why this is the case. I was testing several random gray images where I believed there did not exist a pure black or pure white portion of the image, though I still got 0 as the min pixel and 255 as the max pixel.

It seems that all images have 0 as the min and 255 as the max even if the image does not display a pure white or black in a grayscale setting.

I tested by the PIL library like this:

x = numpy.asarray(PIL.Image.open('gray.webp'))
print(x.min())
print(x.max())

Is pil manipulating the values so that it fits into a [0,255] range, or is something else going on behind the scenes that I do not understand.

Never mind, I have found an image that does produce a range that is not [0,255], thought it is very specific. It is a picture of pure gray image with no “objects”.