Android examples for Graphics:Bitmap Pixel
get Bitmap Pixels
//package com.java2s; import android.graphics.Bitmap; public class Main { public static int[] getBitmapPixels(Bitmap bitmap, int x, int y, int width, int height) { int[] pixels = new int[bitmap.getWidth() * bitmap.getHeight()]; bitmap.getPixels(pixels, 0, bitmap.getWidth(), x, y, width, height); final int[] subsetPixels = new int[width * height]; for (int row = 0; row < height; row++) { System.arraycopy(pixels, (row * bitmap.getWidth()), subsetPixels, row * width, width); }//from w ww . ja v a 2s . co m return subsetPixels; } }