Export pixel data

how am i able to export the mask pixel for opaque clouds in Sent2 L1C Data in a format, that envi can handle with?
If i export the mask-pixels to the default *.txt format, Envi is unable to read the file.
My overall intention is to get a envi mask-band from the mask-pixels in snap.


the procedure to generate and export a ‘opaque_clouds’ mask from Sentinel-2 data to be used in ENVI should the following:

  • Open Sentinel-2 data (better to work on single granules rather then the full Sentinel-2 product)
    File --> Open Products --> Select xml file of your product of interest

  • Resample all the bands to a common resolution (e.g. B2 at 10m)
    Raster --> Geometric Operations --> Resampling

  • Generate a new band using the mask of interest (‘opaque_clouds_10m’ in this example)
    Raster --> Band Maths
    Set ‘Name’ field to ‘Mask Band’
    Uncheck ‘Virtual’ option
    Set ‘Band maths expression’ field to ‘opaque_clouds_10m ? 0 : 1’

  • Subset the product
    Raster --> Subset
    In ‘Band subset’ tab uncheck all the bands except ‘Mask Band’

  • Convert product datatype
    Raster --> Data Conversion --> Convert Datatype
    Set ‘Save as’ field to ‘ENVI’
    Set ‘Target Data Type’ field to ‘uint8’
    Set ‘Scaling’ field to ‘Truncate’

Hope it helps,


1 Like

Thanks a lot !! Thats what i searched for!