How Can I Make Some Pixels Transparent?

If you want to have pixels transparent (or semi-transparent), you can follow the steps:

  • format=image/png (note that PNGs are larger than JPGs, which might affect download speed)
  • custom script output needs to have 4 channels, fourth one being alpha, e.g. "return[1,0,0,0.5]" for semi-transparent red pixel or "return[0,0,0,0]" for full transparency

E.g. if you want to have a Hollstein's cloud overview layer shown in a way, that everything except clouds is transparent, you just needs to change;

let naturalColour = [B04, B03, B02].map(a => gain * a);

          let CLEAR  = naturalColour;

          let SHADOW = naturalColour;

          let WATER  = [0.1,0.1,0.7];

          let CIRRUS = [0.8,0.1,0.1];

          let CLOUD  = [0.3,0.3,1.0];

          let SNOW   = [1.0,0.8,0.4];

to

let naturalColour = [0,0,0,0];

          let CLEAR  = naturalColour;

          let SHADOW = naturalColour;

          let WATER  = [0.1,0.1,0.7,1];

          let CIRRUS = [0.8,0.1,0.1,1];

          let CLOUD  = [0.3,0.3,1.0,1];

          let SNOW   = [1.0,0.8,0.4,1];

Note that all other outputs need to be 4-channel ones as well.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.