0

i created a new image by combining two images. but the size of the final is image is reduced to the size(resolution) of the screen. the code used is

    Bitmap pic = BitmapFactory.decodeResource(getResources(), R.drawable.me);
    Bitmap stat= BitmapFactory.decodeResource(getResources(), R.drawable.static);
    Bitmap out1 = Bitmap.createBitmap(stat) ;
    Canvas comboImage = new Canvas(out1);
    comboImage.drawBitmap(map, 0, 0, null); 
    comboImage.drawBitmap(pic, 150f, 30f, null); 

after this i am storing the image as

     OutputStream os = null;
     os = new FileOutputStream("/sdcard/DCIM/Camera/" + "myNewFileName5.png");
     out1.compress(CompressFormat.PNG, 100, os);
     os.flush();
     os.close();

dimension of image is staic 640x480. but my final image is 320x240, which is my phones screen resolution. is it because i use Canvas? is there any way to do this without changing the image sizes?

sandeep
  • 937
  • 2
  • 12
  • 22

1 Answers1

0

Check your API version? There's an explanation at In the onDraw() method, why does the supplied Canvas already have scale? that for an API level lower than 4 the canvas has a default scaled compatibility mode as if it were targeting a G1 screen.

Community
  • 1
  • 1
Torid
  • 4,176
  • 1
  • 28
  • 29