Skip to content

Instantly share code, notes, and snippets.

@chico
Created October 31, 2014 10:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chico/7b374a28691de4a1f957 to your computer and use it in GitHub Desktop.
Save chico/7b374a28691de4a1f957 to your computer and use it in GitHub Desktop.
GPUImage.saveToPictures blocks UI with preview
// in onCreate()
glSurfaceView = (GLSurfaceView) findViewById(R.id.surfaceView);
mGPUImage = new GPUImage(this);
mGPUImage.setGLSurfaceView(glSurfaceView);
// on user button click
mCamera.mCameraInstance.takePicture(null, null, new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] data, final Camera camera) {
camera.startPreview();
Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
// GPUImage.saveToPictures blocks UI and view goes black for up to 5 seconds when saving high resolution picture
mGPUImage.saveToPictures(bitmap, "GPUImage", null);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment