如何限制图片的大小从IMAGE_CAPTURE了意向 [英] How to limit the picture size took from IMAGE_CAPTURE intent

查看:400
本文介绍了如何限制图片的大小从IMAGE_CAPTURE了意向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用

Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");  
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(getSomePath()+"temp.jpg"))); 
//intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);  
startActivityForResult(intent, 0);   

要得到一个图像和保存的图片返回作为全尺寸。

to get a picture and the saved picture returns as full-size.

但我希望得到一个有限的图片,像800 * 640,因为在不同的设备我得到不同的尺寸,我不需要那么大的图片。

But I want to get a limited picture, like 800*640, because on different devices I get different sizes, and I don't need that big picture.

我注意到有一个在MediaStore EXTRA_SIZE_LIMIT,但我找不到如何使用它应该设置什么参数?

I notice that there is a EXTRA_SIZE_LIMIT in MediaStore , but I can't find how to use it, what parameter should be set?

推荐答案

回答我的问题。

最后,我发现,这是因为不同厂商的定制自己的连不上,包括摄像头的应用程序,所以最好的办法就是不要调用默认的相机应用,而不是我们可以写一个活动中使用 hardware.camera 进行拍照。有很多的例子这个在互联网了。

Finally I found that's because different manufacturers customize their Rom, including the Camera app, so the best way is not to call the default camera app, instead we can write a activity use hardware.camera to take picture. There are a lot of examples for this around the Internet too.

这篇关于如何限制图片的大小从IMAGE_CAPTURE了意向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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