Search code examples
androidimagephotomilestone

Android Image Capture Saving Small Sizes on Milestone


I've written a simple app that opens the camera and supplies a path for saving any captured images.

The code basically looks like this:

File file = new File( Environment.getExternalStorage() + "myimages/",
"my_image.jpg" );

Uri outputUri = Uri.fromFile( file );

Intent intent = new
Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
Intent.putExtra( MediaStore.EXTRA_OUTPUT, outputUri );

This works perfectly on my Droid. Images are consistently saved at 2592x1936. However, when testing on the Milestone, the images are saved at much smaller sizes such as 320x240 and 1280 x 1900. Using adb logcat, I can see that the image size is set as soon as the photo is taken.

It seems like there is a default setting on the Milestone causing this behavior.

Any help would be greatly appreciated.

Thanks, ~Jeremy


Solution

  • Every phone has its own manufacturer written camera app. Every camera app decides how much to resize and/or compress any images taken. If you test on more phones, you will probably find that you're getting a variety of different image sizes and qualities. As long as you are using intents, it is up to whatever Activity that the user chooses to handle that intent (which could always be different than the default camera app anyway) to decide what to do with it.

    If you want to enforce a particular image size or quality, you need to write your own camera activity. Keep in mind that different phones are going to have different hardware that takes images at a huge variety of different resolutions anyway. You should be able to get better than 320x240, but you will not be able to get a consistent size across all phones because the hardware is different.