# Convert float 32 .tif image to int8 .jpg

**URL:** <https://forum.opencv.org/t/convert-float-32-tif-image-to-int8-jpg/9651>\
**Category:** Python\
**Created:** [July 27, 2022, 2:59pm UTC](https://forum.opencv.org/t/convert-float-32-tif-image-to-int8-jpg/9651 "2022-07-27T14:59:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike123](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@mike123](https://forum.opencv.org/u/mike123)\
**Post date:** [July 27, 2022, 2:59pm UTC](https://forum.opencv.org/t/convert-float-32-tif-image-to-int8-jpg/9651/1 "2022-07-27T14:59:51Z")

</div>

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…

---

<div class="post-metadata">

**Author:** ![crackwitz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opencv.org/crackwitz/32/14_2.png) [@crackwitz](https://forum.opencv.org/u/crackwitz)\
**Post date:** [July 27, 2022, 6:25pm UTC](https://forum.opencv.org/t/convert-float-32-tif-image-to-int8-jpg/9651/2 "2022-07-27T18:25:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mike123](https://avatars.discourse-cdn.com/v4/letter/m/ecc23a/32.png) [@mike123](https://forum.opencv.org/u/mike123)\
**Post date:** [July 27, 2022, 9:28pm UTC](https://forum.opencv.org/t/convert-float-32-tif-image-to-int8-jpg/9651/3 "2022-07-27T21:28:34Z")

</div>

> [@crackwitz](#):
>
> 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?

How do I read all these??

---

<div class="post-metadata">

**Author:** ![matti.vuori](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@matti.vuori](https://forum.opencv.org/u/matti.vuori)\
**Post date:** [July 29, 2022, 8:51pm UTC](https://forum.opencv.org/t/convert-float-32-tif-image-to-int8-jpg/9651/4 "2022-07-29T20:51:53Z")

</div>

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.
