Java tutorial
//package com.java2s; import android.graphics.Bitmap; public class Main { static public Bitmap cropBitmap(Bitmap src, int x, int y, int width, int height, boolean isRecycle) { if (x == 0 && y == 0 && width == src.getWidth() && height == src.getHeight()) { return src; } Bitmap dst = Bitmap.createBitmap(src, x, y, width, height); if (isRecycle && dst != src) { src.recycle(); } return dst; } }