I am working on a distributed application of android.I have splitted a single image into lets say 4 parts and then processed it. Now I want to combine 4 bitmap images into a
You need to create a function of bitmap type. That is, it returns a bitmap data type. The function should have an argument of data type Bitmap which is an array.
Download demo here
You will pass your images to the function as array of bitmap. This is our function to merge not only four images but any size of images.
private Bitmap mergeMultiple(Bitmap[] parts){
Bitmap result = Bitmap.createBitmap(parts[0].getWidth() * 2, parts[0].getHeight() * 2, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(result);
Paint paint = new Paint();
for (int i = 0; i < parts.length; i++) {
canvas.drawBitmap(parts[i], parts[i].getWidth() * (i % 2), parts[i].getHeight() * (i / 2), paint);
}
return result;
}
Finally you are done.. Read more here