从另一个应用程序的活动更改相机设置
我有一个 Android 应用程序,它调用本机相机应用程序来拍照并返回图像以进行进一步操作。我的问题是,如果相机设置为 2(+) 兆像素,我会遇到内存泄漏。理想情况下,我希望将其设置为最低 (VGA),因为此应用程序不关心图像质量。
有没有办法从我的应用程序更改本机设备的相机应用程序的设置?这是我正在使用的代码:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
mImageCaptureUri =
Uri.fromFile(new file(Environment.getExternalStorageDirectory(),
"fname_" + String.valueOf(System.currentTimeMillis()) + ".jpg"));
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, mImageCaptureUri);
任何帮助将不胜感激。
I have an Android app that calls the native camera app to take a picture and returns the image for further manipulation. My problem, is that I run into memory leaks if the camera is set to 2(+) megapixels. Ideally, I want it set to the lowest (VGA) since image quality is not a concern with this app.
Is there a way from my app to change the settings of the native device's camera app? Here is the code I am using:
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
mImageCaptureUri =
Uri.fromFile(new file(Environment.getExternalStorageDirectory(),
"fname_" + String.valueOf(System.currentTimeMillis()) + ".jpg"));
intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT, mImageCaptureUri);
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,无法告诉相机应用程序您想要以什么分辨率拍摄照片。
但是,您可以在应用程序中通过访问一些位图功能来自行处理此问题,例如(第二个选项更适合您的需求)
下采样。样本大小应大于 1。尝试 2 和 4。
BitmapFactoryOptions.inSampleSize = sampleSize;
使用原始位图所需的大小创建新位图..
Unfortunately there is no way of telling the camera application what picture resolution you want to take the picture at.
But you can however do something about it yourself in your app by acesssing some bitmap functionalities like (2nd option would be more suited for your needs)
Downsampling. Sample size should be greater than 1. Try 2 and 4.
BitmapFactoryOptions.inSampleSize = sampleSize;
Creating a new bitmap with the size that you require from the original bitmap..