I am trying to export my LULC masked image (classified) to PNG format. I tried this method Raster > Conversion > Translate as said here. My masked image has been classified into 4 covers only, but when following the conversion steps (as shown in above steps) the range changed from 0-255, when I want it to be between 0-3.

enter image description here

Thane_2019_Composite -> Is my classified image in .tif

temp -> after converting to .png

What am I doing wrong?

  • Once the image is a PNG the pixels no longer hold a classified 'value' per se, they are now a colour. The 0-255 is the greyscale value of each pixel.
    – Matt
    Commented Mar 14, 2022 at 11:43
  • @Matt So, are you saying if I want to further train this masked image in a Neural Network, I can safely keep my output layer as 4? This grayscale will not affect the classification?
    – Learner
    Commented Mar 14, 2022 at 12:10
  • If there is a crisp boundary between classifications in your PNG then it should still only hold 4 values, indeed.
    – Matt
    Commented Mar 14, 2022 at 12:13
  • Click some pixels in your PNG in QGIS using the Info tool and make sure they are the same values as the TIFF layer, and are only one band. PNGs are usually 3 band RGB images, but 1-band PNGs are valid.
    – Spacedman
    Commented Mar 14, 2022 at 12:14


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.