Android examples for Graphics:Bitmap Crop
cut Bitmap to piece and return a list of Bitmap
//package com.java2s; import android.graphics.Bitmap; public class Main { public static int HORIZONTAL = 2; public static int VERTICAL = 1; public static Bitmap[] cut(Bitmap raw, int count, int direction) { int width = raw.getWidth(); int height = raw.getHeight(); int partHeight = (direction == VERTICAL ? height / count : height); int partWidth = (direction == HORIZONTAL ? width / count : height); Bitmap[] result = new Bitmap[count]; if (direction == HORIZONTAL) { for (int i = 0; i < count; i++) { result[i] = Bitmap.createBitmap(raw, i * partWidth, 0, partWidth, partHeight); }/*from ww w.ja v a2 s . c o m*/ } else { for (int i = 0; i < count; i++) { result[i] = Bitmap.createBitmap(raw, 0, i * partHeight, partWidth, partHeight); } } return result; } }