In my android application I have a Bitmap and I want to create another bitmap which is cropped out of this bitmap. In other words I want to get a particular portion from the original Bitmap.
I am using Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height)
but the image which I get in return appears to be zoomed in.
What could be the reason, and how can I correct this?
Please help
Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height) is definitely the correct method. I suspect you’re just using the parameters incorrectly.
E.g. To get the centre 50×50 pixels of a 100×100 bitmap named img, you’d use:
Bitmap.createBitmap(img, 25, 25, 50, 50);