Just in case someone is trying to solve same problem, there is a better solution: Bitmap.createBitmap(Bitmap, int x, int y, int width, int height)
. For example, if you need to crop 10 pixels from each side of a bitmap then use this:
Bitmap croppedBitmap = Bitmap.createBitmap(originalBitmap, 10, 10, originalBitmap.getWidth() - 20, originalBitmap.getHeight() - 20);