开发者

How to set the size of photo before capturing on Android

I code the capturing photo by using surfaceView and su开发者_JAVA技巧rfaceHolder.

How to fix the size of image?


@Override
public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
    if (isPreviewRunning) {
        camera.stopPreview();
    }
    Camera.Parameters p = camera.getParameters();

    p.setPictureFormat(PixelFormat.JPEG);
    //p.setPictureSize(getWindowManager().getDefaultDisplay().getWidth(), getWindowManager().getDefaultDisplay().getHeight());
    p.setPictureSize(600,600);

    p.setWhiteBalance(Camera.Parameters.WHITE_BALANCE_FLUORESCENT);

    p.setPreviewSize(getWindowManager().getDefaultDisplay().getWidth(), getWindowManager().getDefaultDisplay().getHeight());

    camera.setParameters(p);
    camera.setDisplayOrientation(90);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜