Skip to content Skip to sidebar Skip to footer

How To Split Image To 2 Parts?

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.createBitm

Solution 1:

Here's some pseudo code, that I hope you can use:

BitmaporiginalBm= BitmapFactory.decodeFile("fileUrl"); // Let's say this bitmap is 300 x 600 pixelsBitmapbm1= Bitmap.createBitmap(originalBm, 0, 0, originalBm.getWidth(), (originalBm.getHeight() / 2));
Bitmapbm2= 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.

Post a Comment for "How To Split Image To 2 Parts?"