title: How to set pixel value into specific one if condition is met?
body: <p>I have an image based on RGBA mode, it has a transparent background like below.</p>
  
  <p>The red dot I have noted has a pixel value of <code>(2, 2, 3, 45)</code>, representing R, G, B, and alpha values. </p>
  
  <p>I want to make all pixels, whose alpha value is lower than <code>45</code> turn to be <code>(0, 0, 0, 0)</code>. I searched for a while, but I only discovered that <code>numpy.where</code> has similar function, but it only suits to single data like R value or B value rather than whole pixel tuples:</p>
  
  <p>Here is some pseudo code of what I want to achieve:</p>
  
  <pre class="lang-none prettyprint-override"><code>if pixel's alpha value &lt;= 45:
      pixel = (0,0,0,0)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/xPUvx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xPUvx.png" alt="enter image description here"></a></p>