Skip to main content

Good afternoon. I have one raster with 4 bands (RGBA). The alpha band shows transparency (255 is transparent and 0 is opaque). Furthermore I have another raster that I have to multiply with first. Is it possible to extract any values (i.e R=179,G=227,B=249,A=255) and set alpha band as 0 (opaque) and leave the rest of raster with its original values for multiplying later?

Thank you at all.

Normally the alpha band works in the reverse. Values of 0 are transparent and 255 are opaque.

 

 

That said, you can use the rasterExpressionEvaluator with conditional expressions. https://knowledge.safe.com/articles/1226/using-conditions-with-the-rasterexpressionevaluato.html

 

 

Example

 

Alpha8: if (Ai0]==179 && Am1]==227 && Am2] == 249 && Am3]==255, 0, A 3])

If the pixel is (179,227,249,255) set it to 0, otherwise keep the existing value.

 

you would set the RGB bands to simply Ami] with i being the index of the band.

Reply