2

I am new to QGIS. I wanted to negate (behaving like NOT gate in a digital circuit) the MASK I have obtained earlier. That means I want to convert all 0s to 1 and all 1s to 0s. Is there any way to do it using raster calculation?

3

You can use the following expression in the raster calculator:

(("LayerName@1" = 0) AND (("LayerName@1" = 1) - 1))

Example, The input Test data has a pixel values of 0 and 1.

enter image description here

Running the above equation as follows:

(("Test@1" = 0) AND (("Test@1" = 1) - 1))

It produced the following result:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.