How to split image to 2 parts? [closed]
I'm a beginner with android. I want to divide a bitmap image into chunks and then display the image in the same way but divided.
Edit:
This code has worked for me
Bitmap.createBitmap(Bitmap source, int x, int y, int width, int height)
Here's some pseudo code, that I hope you can use:
Bitmap originalBm = BitmapFactory.decodeFile("fileUrl"); // Let's say this bitmap is 300 x 600 pixels
Bitmap bm1 = Bitmap.createBitmap(originalBm, 0, 0, originalBm.getWidth(), (originalBm.getHeight() / 2));
Bitmap bm2 = Bitmap.createBitmap(originalBm, 0, (originalBm.getHeight() / 2), originalBm.getWidth(), (originalBm.getHeight() / 2));
So, basically - bm1 is the first half and bm2 is the second half. Both will be 300 x 300 pixels.
精彩评论