2

Please help me to solve this problem. I didn't find any stuff regarding to my problem. I have successfully implemented rotation code for bitmap using JNI library followed by steps- which i followed. With the help of these steps, i got rotated bitmap from JNI library. But when i saved rotated bitmap in to SD card, image size almost doubles like 4MB image turns into 8MB image with same quality.

Please help me to solve this problem.

Code:

        JniBitmapHolder bitmapHolder = new JniBitmapHolder();
        bitmapHolder.storeBitmap(For_rotate_img);

        For_rotate_img.recycle();

        if (rightRotation == true) {
            bitmapHolder.rotateBitmapCw90();
        } else if (leftRotation == true) {
            bitmapHolder.rotateBitmapCcw90();
        }

        scaledBitmapNN = bitmapHolder.getBitmapAndFree();

        if (scaledBitmapNN != null) {
            // if (pDialog_rotation != null) {
            // pDialog_rotation.dismiss();
            // }
            SaveRotatedIamge(img_path, scaledBitmapNN);
        } else {

            // if (pDialog_rotation != null) {
            // pDialog_rotation.dismiss();
            // }

            someError = true;

        }
Community
  • 1
  • 1
S. K
  • 171
  • 1
  • 11
  • Probably, you convert a **rgb565** bitmap with 16 bit per pixel to **argb8888** with 32 bit per pixel. – Alex Cohn Dec 05 '15 at 07:21
  • @AlexCohn Cohn - Thanks for answer. I will check this point. – S. K Dec 05 '15 at 07:48
  • @AlexCohn Cohn - I have trid your suggestion. i have changed 32 bit to 16 bit of jni code (uint32_t to uint16_t). Its does not increase size but image colors is destroyed. Any suggestion for this problem? – S. K Dec 05 '15 at 08:31
  • The functions you use are all tuned for 32-bit bitmaps, see the [answer](http://stackoverflow.com/a/18250952/192373) carefully. You will need to develop similar ones for 16-bit. – Alex Cohn Dec 05 '15 at 09:17
  • @AlexCohn - thanks for information. I will take appropriate decision on this problem. – S. K Dec 05 '15 at 11:02

0 Answers0