On Wed, 1 Jun 2022, Pierre Chaponniere wrote:

Hello gdal community !

I'd like to submit your group a question in regards to the use of
gdal_translate function.
I am converting tif images (64bits, 6 bands multispectral) to jpg images
uint8

uint8 can only have 256 distinct values, but from the top plot it appears that you have more than 256 values in each band.

I am not very familiar with the details of the jpeg format, but
many jpeg applications do not support >8bit (eg 12,14, 16 or even more bits) values. Some jpeg libraries can support 12 or 16 bit values, *but only when compiled specially* for such values, and may not support 8bit images at the same time.

I also note that bande 6 has (all?most) values >30000, which suggests that
they may actually actually be *negative* 16bit values.

via the Qgis interface to operate in lot but I face issues with the
conversion of the histogram values.
It appears this gdal-translate truncate the histogram to the 255 first
values.
I therefore tried the scaling (-scale) argument using this line
-scale 0 65536 0 255

But it appears the resulting histogram is spiky (bottom plot)....compare to
the original histogram (top plot)
See image here
https://ibb.co/mGZHCR0

Any idea from your side on how to better represent histogram from this
gdal-translate conversion ?

As hinted above,
you will first need to choose a format with more bits than uint8 jpeg.

--
Andrew C. Aitchison                                     Kendal, UK
                        [email protected]
_______________________________________________
gdal-dev mailing list
[email protected]
https://lists.osgeo.org/mailman/listinfo/gdal-dev

Reply via email to