How to capture low resolution picture using androi

2019-05-18 11:22发布

I want to capture photo and also save it to my sdcard using android camera.I know its easy but I want to store image in low resolution without telling user go to setting and set low resolution manually.

4条回答
叛逆
2楼-- · 2019-05-18 12:01

What i am gonna write is not good practice to do code but it may full-fill your requirement

  • capture image as you do with normally using android default camera .
  • check the path of that image which just now captured .
  • reduce quality of that image as per requirement using BitmapFactory.Options calss and store in bitmap object
  • delete that original image which captured by default camera
  • save that bitmap object to SD Card where old image was located with same file name and path
查看更多
地球回转人心会变
3楼-- · 2019-05-18 12:03

I know this is very late but this is for the people who might read this question now , you can use this following code :

 Camera.Parameters parameters = mcamera.getParameters();
        List<Camera.Size> sizes = parameters.getSupportedPictureSizes();
        Camera.Size size = sizes.get(sizes.size()-1);
        Log.d("Parth","Size : "+size.height+","+size.width);
        Log.d("Parth","Sizes:"+sizes.toString());
        parameters.setPictureSize(size.width,size.height);
        mcamera.setParameters(parameters);
查看更多
何必那么认真
4楼-- · 2019-05-18 12:08

Use this to capture image :

Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
cameraIntent.putExtra(MediaStore.ACTION_IMAGE_CAPTURE, preinsertedUri);

Don't use MediaStore.EXTRA_OUTPUT because the image will be big size if you use EXTRA_OUTPUT

查看更多
兄弟一词,经得起流年.
5楼-- · 2019-05-18 12:13

Implement a camera app by yourself. Use BitmapFactory to decode raw data. Via BitmapFactory.Options, you can set any resolution you want.

查看更多
登录 后发表回答