There is a popular technique of normalising images by dividing each pixel with 255 so that it comes in the range of 0 and 1.
But, then how the same colours are formed when we normalize images.
for instance, there is a pixel with value 0 1 1 and other 0 255 255, I checked on RGB colors chart, both are showing different colors, but if we normalise the second pixel values then its value will be same as the first one and it should produce different results but on plotting the set of normalized pixels, they come out to be same as the previous one.

I have previously asked this question - how RGB images are formed so deriving out conclusions from the above question.

  • $\begingroup$ Somewhere down the line this is still mapped to whatever you monitor supports. $\endgroup$
    – lightxbulb
    Nov 5, 2019 at 20:33

1 Answer 1


Let's suggest an analogy. I have a distance of 1 centimeter and 2.54 centimeters. If I transform the latter distance to inches, then it's 1 inch. This has the same value as the first distance.

But 1 inch is still longer than 1 centimeter, no matter the fact that they both use the numeral 1. These numbers are attached to different units, so simply comparing their numerical values is meaningless.

So it doesn't matter if the 8-bit unsigned, normalized value of 255 happens to have the same value of 1. Because you cannot compare them when they are in different spaces like that. Your original values were both in 8-bit normalized, unsigned integer space. If you want to compare them in a floating-point space, you have to transform both of them.

  • $\begingroup$ superb, I never realised that data type was changing while converting and yes, when converting to same data-type they are giving the expected result. $\endgroup$
    – Mark
    Nov 6, 2019 at 5:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.