In My Business card reader android application , i got high resolution image/large size image, when i was rotation the that image, it will take more time some times it will show outOfMemory exception. so please help me to rotate image bitmap in C/C++ native code.`
I use below code for image rotating.
private Bitmap rotateBitmap(Bitmap source, int angle) {
Matrix matrix = new Matrix();
matrix.postRotate(angle);
Bitmap createBitmap = Bitmap.createBitmap(source, 0, 0,
source.getWidth(), source.getHeight(), matrix, true);
source.recycle();
return createBitmap;
}
`
图像旋转仅在本机代码中发生,因此需要重写同一件事,需要改进实现,如果共享一些代码会很好
Have a look at solution for OutOfMemoryError:bitmap in stackoverflow you might find something there. And post your answer if you find something(I realy wonder how you deal with that:) )
I found some nice explanations when searching in google like outofmemoryexception bitmap android
and a tutorial on avoid outofmemroyexception while scaling image
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.