title: How to check fast the color of the pixels on a bitmap in android
body: <p>I go through a bitmap in android and i want to get a the color of each pixel and count it if it has a certain value i.e if it is brown.</p>
  
  <p>I use the following code. The code works but it is extremely slow due to the big number of pixels in the image, which of course I need for correct results.</p>
  
  <pre><code>for(int i =  1; i &lt;= 100; i++){
      for(int j = 1; j &lt;= 100; j++) {
          int pixel =  bitmap.getPixel(i,j);
  
          R1 = Color.red(pixel);
          G1 = Color.green(pixel);
          B1 = Color.blue(pixel);
  
          if((R1 == 155) &amp;&amp; (G1 == 155) &amp;&amp; (B1 == 155)) {
              countthecolor = countthecolor + 1;
          }
      }    
  }          
  </code></pre>