【问题标题】:Saving URI image or converting to bitmap while maintaining resolution在保持分辨率的同时保存 URI 图像或转换为位图
【发布时间】:2013-05-08 00:13:03
【问题描述】:

所以我已经让我的图像成功传递到一个 URI...但是我不知道如何保存它或将它转换为位图,同时仍然保持分辨率。有什么建议?谢谢。

photoButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            // CALL THE PICTURE (this works)

            File t = new File (STORAGE_PATH + "savedAndroid.jpg");
            mURI = Uri.fromFile(t);
            i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
            i.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, mURI);
            startActivityForResult(i,0); //0 is default camera
        }
    });

protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    imageView.setImageURI(mURI); //this seems to work...by itself


      //save the image or convert it to a bitmap to use with tesseract...
}

【问题讨论】:

    标签: java android android-intent android-camera saving-data


    【解决方案1】:
    InputStream is = context.getContentResolver().openInputStream(mURI);
    Bitmap bitmap = BitmapFactory.decodeStream(is, null, new BitmapFactory.Options());
    

    然后随心所欲地使用它。 希望这会有所帮助。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-11-05
      • 1970-01-01
      • 2020-01-15
      • 2016-12-18
      • 1970-01-01
      相关资源
      最近更新 更多