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

3

我希望在ImageView中展示高质量的图片并上传到服务器。我在网上、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个回答

9
您发送的Intent仅返回作为小位图的低质量图片。
如果您想获得全分辨率的图像,需要准备一个文件来保存这个图像,并向相机应用程序提供所有必要的信息。详情请参见保存全尺寸照片,包括所有说明和代码示例。

我不想保存这张图片,但是我希望以我拍摄时的质量发送这张图片。 - evgeny
@evgeny,你不能这样做有两个原因:1)上传文件更容易;2)“Intent”只能保存有限的数据量,无法保存高分辨率图片。 - lenik

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接