3

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;

    }

`

2 Answers2

0

Image rotation happens only in native code, so need to rewrite the same thing, you need to improve your implementation, it will be good if you share some piece of code

Kapil Vats
  • 5,485
  • 1
  • 27
  • 30
0

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

Community
  • 1
  • 1
Ismail Sahin
  • 2,640
  • 5
  • 31
  • 58