Nitish Patel
Nitish Patel

Reputation: 1026

How to capture low resolution picture using android camera

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.

Upvotes: 5

Views: 9582

Answers (4)

Parth Anjaria
Parth Anjaria

Reputation: 3971

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);

Upvotes: 2

Harish Godara
Harish Godara

Reputation: 2386

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

Upvotes: 1

dharmendra
dharmendra

Reputation: 7881

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

Upvotes: 2

yushulx
yushulx

Reputation: 12150

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

Upvotes: 1

Related Questions