Android:通过相机活动裁剪图像的问题
我制作了一个应用程序,其中我从相机捕获了图像,并显示一个矩形来裁剪选定的区域。但我面临两个大问题:
当我们改变矩形的尺寸时,它看起来很大 用于裁剪图像,而不是显示裁剪后的图像文件 它会重新启动相机活动?而我也做了同样的事情 从图库中获取图像并且它正在工作。
长宽比不适用于从相机活动拍摄的图像?
相机活动代码:
public void onClick(DialogInterface dialog, int item)
{
Intent intent = new Intent();
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 774);
intent.putExtra("aspectY", 1115);
intent.putExtra("outputX", 774);
intent.putExtra("outputY", 1115);
if(item==0)
{
intent.setAction("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, PICK_FROM_CAMERA);
}
I have made an App in which I have captured an image from camera and a rectangle is shown to crop the selected area. But I'm facing two big problems in it:
when we change the dimensions of rectangle appeared to large size
for cropping the image then instead of showing cropped image file
it restart camera activity?while the same thing I have done in
taking image from gallery and it is working.aspect ratio is not working for image taken from camera activity?
Code for camera activity:
public void onClick(DialogInterface dialog, int item)
{
Intent intent = new Intent();
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 774);
intent.putExtra("aspectY", 1115);
intent.putExtra("outputX", 774);
intent.putExtra("outputY", 1115);
if(item==0)
{
intent.setAction("android.media.action.IMAGE_CAPTURE");
startActivityForResult(intent, PICK_FROM_CAMERA);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
更多
发布评论
评论(1)
查看这些链接
http://www.brighthub.com/mobile/ google-android/articles/43414.aspx
http://androidcore.com/android-programming-tutorials/629.html
如何在 Android 模拟器中使用网络摄像头捕获实时图像?
http://www.tomgibara.com/android/camera-source
http://marakana.com/forums/android/examples/39.html
check out these links
http://www.brighthub.com/mobile/google-android/articles/43414.aspx
http://androidcore.com/android-programming-tutorials/629.html
How to use web camera in android emulator to capture a live image?
http://www.tomgibara.com/android/camera-source
http://marakana.com/forums/android/examples/39.html