。data.getExtras()获得(QUOT;数据")在Android的低分辨率图像的结果 [英] data.getExtras().get("data") result of low resolution image in android

查看:1201
本文介绍了。data.getExtras()获得(QUOT;数据")在Android的低分辨率图像的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用我从相机拍摄照片,然后我得到的图片做同样的画面部分的图像处理操作,但是当我拿到这幅画data.getExtras()。获得(数据),画面配有低分辨率不是真正的拍摄分辨率。可能是什么问题的原因是什么?

code就是这样;

 意向意图=新意图(android.provider.MediaStore.ACTION_IM​​AGE_CAPTURE);
          startActivityForResult(意向,CAMERA_PIC_REQUEST);
    }    保护无效的onActivityResult(INT申请code,INT结果code,意图数据)
    {
        如果(要求code!= 0)
        {
            ImageView的图像=(ImageView的)findViewById(R.id.imageView1);
                。缩略图=(位图)data.getExtras()获得(数据);


解决方案

广播意图之前,您应该包括群众演员吧:

  intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,imageFileUri);

在这里imageFileUri可能是SD卡上的输出文件名:

  imageFileUri = Uri.parse(文件:///sdcard/picture.jpg);

这将节省图像已知位置,并采取图片后,你将能够处理它。

In my app I take a picture from camera and then I get that picture to do some image processing operations on same picture but when I get this picture with data.getExtras().get("data") , picture come with low resolution not real taken resolution. What can be reason of the problem?

Code is like that;

    Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
          startActivityForResult(intent , CAMERA_PIC_REQUEST);
    }

    protected void onActivityResult(int requestCode , int resultCode , Intent data )
    {
        if( requestCode != 0)
        { 
            ImageView image = (ImageView)findViewById(R.id.imageView1);
                thumbnail = (Bitmap)data.getExtras().get("data");

解决方案

Before broadcasting intent, you should include extras to it:

intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, imageFileUri);

where imageFileUri could be output file name on SD card:

imageFileUri=Uri.parse("file:///sdcard/picture.jpg");

That would save image to known location and after taking image you would be able to process it.

这篇关于。data.getExtras()获得(QUOT;数据")在Android的低分辨率图像的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆