0

I'm trying to build an app, that captures a picture and sends the picture to another activity. I'm trying to display this picture in the second activity and apparently the quality of picture is very low.

Here is my code so far

Intent cameraIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
startActivityForResult(cameraIntent, PICTURE_TAKEN);

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

        super.onActivityResult(requestCode, resultCode, data);      

        if(resultCode == RESULT_OK){
            Intent canvasIntent = new Intent(this ,canvas.class);

            Bundle extras = data.getExtras();
            bmpCameraResult = (Bitmap)extras.get("data");
            canvasIntent.putExtra("bmp_Image", bmpCameraResult);            
            startActivity(canvasIntent);                

        }

and in the canvasActivity, I'm trying to receive the bitmap in the conventional fashion and trying to display it.

Intent intent= getIntent();
        Bitmap bmp = (Bitmap) intent.getParcelableExtra("bmp_Image");
        ImageView iv = new ImageView(this);        
        iv.setImageBitmap(bmp);      
        setContentView(iv);

What could be the reason for this reduction of quality? What is the optimized way of getting the high quality image?

Thank You.

Sriram Bandaru
  • 55
  • 1
  • 1
  • 7

1 Answers1

0

Did you try to set jpegQuality (setJpegQuality) in your Camera Parameters (Camera.Parameters) as you can read here: Camera Feature Documentation?

I think you should also read these answers about the same issue:

  1. Android: Not able to get original photo captured by camera (Able to read compress photo only)
  2. Low picture/image quality when capture from camera
Community
  • 1
  • 1
Blo
  • 11,903
  • 5
  • 45
  • 99