从本地摄像头采集后调整图像大小,但之前保存到SD卡 [英] Resize image after capture it from native camera but before save it to SD card

查看:186
本文介绍了从本地摄像头采集后调整图像大小,但之前保存到SD卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我打开一个默认的摄像头在我的上按钮的应用程序click.when我点击按钮,它的工作原理fine.But它捕捉到默认大小的形象,我想重新大小的图像之前之后它保存在SD卡从默认的摄像头捕捉到它。

I am opening a default Camera in my app on button click.when i click on button ,it works fine.But it capture the image of default size and I want to re-size the image before save it in SD card after capture it from default camera.

推荐答案

使用下面这段code设置合适的宽度和高度相机意图。

Use the following piece of code to set proper width and height for camera intent.

            Intent intent = new Intent( Intent.ACTION_PICK,
            MediaStore.Images.Media.INTERNAL_CONTENT_URI );
    intent.putExtra("outputX",
            width_of_output_image);
    intent.putExtra("outputY",
            height_of_output_image);
    intent.putExtra("aspectX", 1);
    intent.putExtra("aspectY", 1);
    intent.putExtra( "scale", true );
            startActivityForResult( intent, 1 );

这篇关于从本地摄像头采集后调整图像大小,但之前保存到SD卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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