Here you can find the source of getPixelsCount(Bitmap bitmap)
public static int getPixelsCount(Bitmap bitmap)
//package com.java2s; import android.graphics.Bitmap; public class Main { public static int getPixelsCount(Bitmap bitmap) { int hlen = bitmap.getWidth(), vlen = bitmap.getHeight(); int toReturn = 0; for (int i = 0; i < vlen; i++) { for (int j = 0; j < hlen; j++) { if ((bitmap.getPixel(j, i) & 0xff) > 0) { toReturn++;/*w ww . jav a 2 s . c o m*/ } } } return toReturn; } }