-1

I have implemented this photo taking style. When I preview the photo after I take it, it is beautiful, but when I reload it in the app it looks blurry. Here is the code, does anyone know what I can do to fix it?

private void takePhoto(int actionCode) 
    {
        takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        startActivityForResult(takePictureIntent, actionCode);
    }
    protected void onActivityResult(int requestCode, int resultCode, Intent intent)
    {
        super.onActivityResult(requestCode, resultCode, intent);
        Bundle extras = intent.getExtras();
        newImageP = (Bitmap) extras.get("data");
        newImage.setImageBitmap(newImageP);     
    }
jister13
  • 83
  • 1
  • 9

1 Answers1

4

The reason for this is that the Camera activity sends back a thumbnail of the image. If this low quality image gets upscaled, you will see it blurry.

To get the full resolution image you should call the camera activity with the following extra

Intent cameraIntent = new Intent( MediaStore.ACTION_IMAGE_CAPTURE );
cameraIntent.putExtra( MediaStore.EXTRA_OUTPUT, Uri.fromFile(   temporalPictureFile ) );
startActivityForResult(cameraIntent, actionCode);

This is so the camera app can dump the content of the image to a physical file and don't mess with the app memory being very limited. As far as i remember, the file has to exists before passing it in the intent.

Robert Estivill
  • 12,369
  • 8
  • 43
  • 64