title: Merge two image into one but both image as same size in android
body: <p>I have two images. One is taken by camera and another one is browsed from gallery. But are in different size. I need to merge two images to one image. But both are need to same size. I have written code to merge two image to one. But it displaying different image size. One is (taken by camera) is small. Another one (browsed from gallery) is big size. But I need both to be of same size.</p>
  
  <p>My code:</p>
  
  <pre><code>Bitmap cs = null; 
  Bitmap c= bmp;
  Bitmap s = galerypic;
  
  int width, height = 0; 
  
  if(c.getWidth() &gt; s.getWidth()) { 
      width = c.getWidth(); 
      height = c.getHeight() + s.getHeight(); 
  } else { 
      width = s.getWidth(); 
      height = c.getHeight() + s.getHeight(); 
  } 
  
  cs = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); 
  
  Canvas comboImage = new Canvas(cs); 
  
  comboImage.drawBitmap(c, 0f, 0f, null); 
  comboImage.drawBitmap(s, 0f, c.getHeight(), null); 
  
  
  //    String tmpImg = String.valueOf(System.currentTimeMillis()) + ".png"; 
  
  //putStream os = null;
  FileOutputStream outStream = null;
  try { 
      outStream = new FileOutputStream(String.format("/sdcard/merged.jpg"));   
      // os = new FileOutputStream(loc + tmpImg); 
      cs.compress(CompressFormat.PNG, 100, outStream); 
  } catch(IOException e) { 
      Log.e("combineImages", "problem combining images", e); 
  }
  </code></pre>