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);
精彩评论