尽管在 2.X 中指定了 MediaStore.EXTRA_OUTPUT,但从相机检索到小图片
我只是不明白:当我有意使用相机并指定输出文件时,在许多设备上返回的图像总是很小(例如 Motorola Milestone 2.1、HTC Desire 2.1、Emulator 2.1、Emulator 2.0.1 )但并非全部(例如 Nexus One)。这是我打开相机应用程序的方法:
private final static String TEMP_PHOTO_FILE = Environment.getExternalStorageDirectory() + "/TEMP_PHOTO.JPG";
private final static int REQUEST_CAMERA = 0;
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(TEMP_PHOTO_FILE)));
startActivityForResult(intent, REQUEST_CAMERA);
拍摄图像后,我在 onActivityResult(int requestCode, int resultCode, Intent data) 中获取其结果:
if (requestCode == REQUEST_CAMERA && resultCode == RESULT_OK) {
String photo = MediaHandler.moveFile(TEMP_PHOTO_FILE, MediaHandler.SDCARD_IMAGE_PATH, System.currentTimeMillis());
BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
// bitmapOptions.inSampleSize = 6;
imgBitmap = BitmapFactory.decodeFile(photo, bitmapOptions);
位图非常小,我想知道为什么会发生这种情况。我知道它曾经工作正常。
有没有人有同样的问题,甚至有关于如何解决这个问题的提示?
谢谢,
斯特夫
I just don't get it: when I use the camera with an intent and also specify an output file, the returned image is always very small on many devices (e.g. Motorola Milestone 2.1, HTC Desire 2.1, Emulator 2.1, Emulator 2.0.1) but not on all (e.g. Nexus One). Here's what I do to bring up the camera app:
private final static String TEMP_PHOTO_FILE = Environment.getExternalStorageDirectory() + "/TEMP_PHOTO.JPG";
private final static int REQUEST_CAMERA = 0;
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new File(TEMP_PHOTO_FILE)));
startActivityForResult(intent, REQUEST_CAMERA);
After the image has been taken I grab its outcome in onActivityResult(int requestCode, int resultCode, Intent data)
:
if (requestCode == REQUEST_CAMERA && resultCode == RESULT_OK) {
String photo = MediaHandler.moveFile(TEMP_PHOTO_FILE, MediaHandler.SDCARD_IMAGE_PATH, System.currentTimeMillis());
BitmapFactory.Options bitmapOptions = new BitmapFactory.Options();
// bitmapOptions.inSampleSize = 6;
imgBitmap = BitmapFactory.decodeFile(photo, bitmapOptions);
The bitmap is pretty small and I am wondering why this happens. I know that it used to work properly.
Does anyone have the same issue or even a hint on how to fix this?
Thanks,
Steff
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
似乎是一个“更高”的问题: http://code .google.com/p/android/issues/detail?id=1480#makechanges
seems to be a "higher" problem: http://code.google.com/p/android/issues/detail?id=1480#makechanges