I am writing a camera module, which use to take picture.
As the preview's width/height is different from picture's width/height, I need to clip the picture when taken picture, to make it same as what you see in screen.
I use this:
mCamera.takePicture(null, null, mJpegCallback);
to set the picture callback, and then decode and clip the bitmap in callback:
Bitmap originBitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
...
Bitmap bitmap = Bitmap.createBitmap(originBitmap, 0, 0, clipWidth, clipHeight);
However, an OutOfMemoryError
happen when create the clip bitmap.I have tried many ways to reuse the data instead of copying a new bitmap, but it doesn't work. So, please anybody can hep me?