【问题标题】:ACTION_IMAGE_CAPTURE returns poor image quality bitmap, where can I get the hi-res image? [duplicate]ACTION_IMAGE_CAPTURE 返回低图像质量位图,我在哪里可以获得高分辨率图像? [复制]
【发布时间】:2018-06-30 14:55:34
【问题描述】:

我希望在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);
        }
    });

这里有什么问题?

【问题讨论】:

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


    【解决方案1】:

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

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

    【讨论】:

    • 我不想保存图像,但我想以我拍摄的质量发送图像。
    • @evgeny 你不能这样做的原因有两个,1) 上传文件要容易得多 2) Intent 只能容纳这么多数据,不足以容纳高分辨率图片。跨度>
    猜你喜欢
    • 2014-05-10
    • 2017-08-23
    • 2014-11-20
    • 1970-01-01
    • 2018-07-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多