I want to overlay two bitmaps on a canvas and produce a single bitmap. But the second image is much smaller than its original size

I want to overlay two bitmaps on a canvas and produce a single bitmap in android. but second image is much small as its original size. But second image or small image is looking more small on canvas as compare to original bitmap image. I have implemented following code to overlay image and give the left and top align to second image.

public Bitmap overlay(Bitmap bmp1, final Bitmap bmp2, int x, int y) { final Bitmap bmOverlay = Bitmap.createBitmap(bmp1.getWidth(), bmp1.getHeight(), bmp1.getConfig()); Canvas canvas = new Canvas(bmOverlay); canvas.drawBitmap(bmp1, 0f, 0f, null); float density = PdfActivity.this.getResources().getDisplayMetrics().density; canvas.drawBitmap(bmp2, x * density, y * density, null); return bmOverlay;} 

In above code bmp2 is used to draw the second image or small image ,while bmp1 is big image draw on canvas. Please have a look at both screens:- Below is showing image after drawing on canvas.

enter image description here

Please help me to find out what is the issue so image is drawing in small format.

Below is showing original image inside the rectangle after drawing on image view.

enter image description here

Converter URI para Bitmap

Boa tarde,

Estou como uma duvida, como posso converter uma URI para Bitmap e em seguida converter para Base64 assim poder enviar ao Banco de Dados.

private void abrirCamera() {     fileUri = getOutputPictureUri("GRP");      if (fileUri != null) {          // Cria o intent para chamar a câmara         Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);         // seta o caminho do arquivo para guardar a foto         intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);          // inicia a captura da foto         startActivityForResult(intent, CAM_REQUEST);     } }  @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) {     if (requestCode == CAM_REQUEST) {         if (resultCode == RESULT_OK) {            Foto1.setImageURI(fileUri);             }         }     }