Convert float 32 .tif image to int8 .jpg

I am using this code: image2 = cv2.normalize(image, None, 0, 255, cv2.NORM_MINMAX, cv2.CV_8U) in order to transform a .tif 32-bit float integer to 8-bit int .jpeg. The problem is that it destroys the brightness… How can I have the same brightness to .jpg output as the original .tif? I tried 1023 instead of 511, it fixes, but I don’t know if this is a mainstream solution, and If I face problems in the future…

do you have linear data or gamma-mapped?

do you know the min and max values of your data? do these values even matter? does your data have a “nominal” range of values?

input data and code please. show us what you see. we see nothing here.


How do I read all these??

You don’t read them. There is no function to find them out You need to know them or find them out about the source of your data.