Android Camera Set Resolution

前端 未结 2 381
既然无缘
既然无缘 2020-12-14 22:29

I have built a custom Camera App and I am trying to change the resoloution of the image that is took. I have read around that this could depend on the phone or version of An

2条回答
  •  佛祖请我去吃肉
    2020-12-14 23:11

    It's too easy to capture image with high quality, here you can set your own resolution:

    mCamera = Camera.open();
    Camera.Parameters params = mCamera.getParameters();
    
    // Check what resolutions are supported by your camera
    List sizes = params.getSupportedPictureSizes();
    
    // Iterate through all available resolutions and choose one.
    // The chosen resolution will be stored in mSize.
    Size mSize;
    for (Size size : sizes) {
        Log.i(TAG, "Available resolution: "+size.width+" "+size.height);
            mSize = size;
        }
    }
    
    Log.i(TAG, "Chosen resolution: "+mSize.width+" "+mSize.height);
    params.setPictureSize(mSize.width, mSize.height);
    mCamera.setParameters(params); 
    

    Hope this will help you all.

提交回复
热议问题