Export one single band in 16bit


#1

Hello everyone,

I am using Sentinel 2 Level2A-Data. I want to export every single band as 16-bit jpeg2 or tiff. Afterwards I want to load them into ImageJ and make a stack of all bands.

Can anybody help me how to export every single band as 16-bit?

Thanks a lot!


#2

To my understanding, Sentinel2 L2A products already consist of JP2 files in 16 bit:
grafik


#3

Thanks for your fast answer!

The problem is the following: In snap my bands look like this:

I found the jpg2´s in the following folder in my explorer:

If i open them they are mostly black and very dark:

Why is this the case? What am I doing wrong? Do I have to export every band itself?

Thank you!


#4

SNAP adjusts the contrast by visually clipping the upper 2,5 % of values.


#5

Is there a possibility to get them out with the adjusted contrast?


#6

you can use the convert datatype tool, select Int16 as an output format and J2 as the data type and then apply one of the available scalings. This however severely changes the values of your pixels.

grafik

grafik


#7

Unfortunately this does not work in my case. I used all available scalings but the jp2 - outputs are still dark and not as they are in snap.


#8

But that’s how they are.

You can apply a manual stretch of the values in the band maths

Or you directly convert them into dB: right-click > Linear to/from dB. Right-click on the new product and select > Convert band. Then use File > Save Product.
Still, the exreme values remain.


#9

If I open the image of one band and then right click on the image, select “export view as image” and click on “full scene” and “full resolution”, I get a jpeg output in 8bit with the adjusted contrast. Is there a possibility to get the same as a 16bit output?


#10

At best with “Convert datatype”


#11

I will see what I can reach. Thank you very much for your help!


#12

I’m not entirely sure what your purpose is. The “pretty visualization” adapts the contrast such as the value of the pixel corresponding to the percentile 2.5 is set to dark and the percentile 97.5 is set to white. Out of these limits the values are saturated. It is useful to visualize the image that way, to avoid the image to be seen almost dark or almost white.

But that’s only for visualization purposes ! The “almost dark” image that you had corresponds to the true value of pixels. For classification for example, that’s these values that are used.


#13

I think exactly that was my error in reasoning. I of course want to do a classification afterwards so I need the “real values”, not the “pretty ones”. I had a mistake in my thoughts.

Thank you both very much for your answers. I am a student and I am working on my bachelor thesis. This was very helpful now. Thanks!


#14

Glad it helps :slight_smile: Good luck for your project