So i have two images stored locally on an SD card in android and i want to combine them into one image. Its hard to explain so i going to link to a picture for a better example of how i want to take the first two images and combine them into the last.

I am generally using following function from Jon Simon to combine two Bitmap passed as argument and get combined Bitmap as output,
    public Bitmap combineImages(Bitmap c, Bitmap s) 
{ 
    Bitmap cs = null; 
    int width, height = 0; 
    if(c.getWidth() > s.getWidth()) { 
      width = c.getWidth() + s.getWidth(); 
      height = c.getHeight(); 
    } else { 
      width = s.getWidth() + s.getWidth(); 
      height = c.getHeight(); 
    } 
    cs = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); 
    Canvas comboImage = new Canvas(cs); 
    comboImage.drawBitmap(c, 0f, 0f, null); 
    comboImage.drawBitmap(s, c.getWidth(), 0f, null); 
    return cs; 
}  
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With