ACTION_IMAGE_CAPTURE返回的图像质量差的位图,在哪里可以获取高分辨率图像?

时间:2018-06-30 14:55:34

标签: android imageview android-camera android-camera-intent

我希望高质量的图像显示在ImageView中并上传到服务器。我已经搜索了Internet,StackOverflow和GitHub,但是找不到答案,也许有人知道如何解决?

protected void onActivityResult(int requestCode, int resultCode, Intent imageReturnedIntent) { //work android
    super.onActivityResult(requestCode, resultCode, imageReturnedIntent);
    imageReturnedIntent.putExtra(MediaStore.EXTRA_OUTPUT, uri);//try

    if (resultCode == RESULT_OK ) {// work every android than need click OK
      //working
        Uri selectedImage = imageReturnedIntent.getData();//convert to for bitmap that can send
        Bundle extras = imageReturnedIntent.getExtras();//finish converting and copy the image
        bitmap = extras.getParcelable("data");//receive image to bitmap
        imageView.setImageBitmap(bitmap);

onCreate

btnCamera.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
            //intent.putExtra(MediaStore.EXTRA_OUTPUT, imageUri);
            startActivityForResult(intent, 0);
        }
    });

这是怎么了?

1 个答案:

答案 0 :(得分:1)

您发送的Intent仅将低质量的图片作为小位图返回。

如果要使用全分辨率图像,则需要准备文件,该图像将保存在该文件中,并向Camera应用程序提供所有必要的信息。有关详细信息,请访问Save the full-size photo部分,并提供所有说明和代码示例。