Java tutorial
//package com.java2s; import android.content.Context; import android.graphics.Bitmap; import android.graphics.Matrix; public class Main { public static Bitmap[] getBitmapsByBitmap(Context context, Bitmap source, int row, int col, float multiple) { Bitmap bitmaps[] = new Bitmap[row * col]; int temp = 0; for (int i = 1; i <= row; i++) { for (int j = 1; j <= col; j++) { bitmaps[temp] = getImage(context, source, i, j, row, col, multiple, false); temp++; } } return bitmaps; } public static Bitmap getImage(Context context, Bitmap source, int row, int col, int rowTotal, int colTotal, float multiple, boolean isRecycle) { Bitmap temp = getBitmap(source, (col - 1) * source.getWidth() / colTotal, (row - 1) * source.getHeight() / rowTotal, source.getWidth() / colTotal, source.getHeight() / rowTotal); if (isRecycle) { recycleBitmap(source); } if (multiple != 1.0) { Matrix matrix = new Matrix(); matrix.postScale(multiple, multiple); temp = Bitmap.createBitmap(temp, 0, 0, temp.getWidth(), temp.getHeight(), matrix, true); } return temp; } public static Bitmap getBitmap(Bitmap source, int x, int y, int width, int height) { Bitmap bitmap = Bitmap.createBitmap(source, x, y, width, height); return bitmap; } public static void recycleBitmap(Bitmap b) { if (b != null && !b.isRecycled()) { b.recycle(); b = null; } } }