Java tutorial
//package com.java2s; import android.graphics.Bitmap; public class Main { public static Bitmap cropCenter(Bitmap source, int targetWidth, int targetHeight) { int marginLeft = (source.getWidth() - targetWidth) / 2; int marginTop = (source.getHeight() - targetHeight) / 2; Bitmap newBitmap = Bitmap.createBitmap(source, marginLeft, marginTop, targetWidth, targetHeight); return newBitmap; } }