Mostly your problem arises from the fact that you are creating a bitmap image. You donβt invest anything in it. Then you create a smaller raster map, and then render the imageView with a smaller raster image.
This cuts off the bottom 100 pixels and 20 pixels.
You need to create a big bitmap. Add image data to this bitmap. Then resize it.
The following code should work:
Bitmap bitmap = Bitmap.createBitmap(imgView.getWidth(),imgView.getHeight(), Bitmap.Config.RGB_565); Canvas canvas = new Canvas(bitmap); imgView.draw(canvas); Bitmap result =Bitmap.createBitmap(bitmap,imgView.getLeft()+10, imgView.getTop()+50, imgView.getWidth()-20, imgView.getHeight()-100); bitmap.recycle();
source share