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

evg*_*eny 1 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);
Run Code Online (Sandbox Code Playgroud)

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);
        }
    });
Run Code Online (Sandbox Code Playgroud)

这里有什么问题?

len*_*nik 7

Intent您发送只返回低质量画面,作为一个小位图。

如果您想要全分辨率图像,则需要准备文件,该文件将保存在该文件中,并向相机应用程序提供所有必要的信息。详细信息可在保存全尺寸照片部分获得,包括所有解释和代码示例。