Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
424 views
in Technique[技术] by (71.8m points)

android - App -> Camera -> Photo -> low resolution

Problem:

When I use my app to take a photo and store it on SD, the resolution is 160x120. If using camera ordinary, resolution of photos is 1920x2560.

So, please help me saying what I have to do to force camera, started from the app, to take a photo in the standard high resolution?

This is the code I use for starting camera intent and saving the photo:

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
    startActivityForResult(cameraIntent, CAMERA_REQUEST); 
}
public void onActivityResult(int requestCode, int resultCode, Intent data) {  
    if (requestCode == CAMERA_REQUEST) { 

    Bundle xz = data.getExtras();
    if (xz!=null) {

    Bitmap image = (Bitmap) data.getExtras().get("data");

    String filePath = "/mnt/sdcard/DCIM/"; 
    filePath += "hml.png";
 try {
  image.compress(Bitmap.CompressFormat.PNG, 100, new FileOutputStream(new File(filePath)));
 } 
    catch (FileNotFoundException e) {
                 // TODO Auto-generated catch block
                e.printStackTrace();}  
    catch (NullPointerException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();       } 
    }}

Thanks you!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you don't supply a uri for the output image, the camera intent will return only a thumbnail of the picture. Follow these instructions on how to do this properly: http://www.tutorialforandroid.com/2010/10/take-picture-in-android-with.html


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...