If you are trying to prevent OutOfMemory or something else ...
you can create a buffer with your image data,
BitmapFactory.Options buffer = new BitmapFactory.Options(); buffer.inJustDecodeBounds = true; BitmapFactory.decodeByteArray(photo, 0, photo.length, buffer);
Then you can get the size using buffer.outHeight, buffer.outWidth ..
If you want to scale, you just use buffer.isSampleSize, but I noticed that you set the value to "10" there ... which I think is wrong ... sampleSize should get the value 2 ^ .. as 2, 4, 8, 16 etc.
Finally, after installing sampleSize, you can create a bitmap as always.
Bitmap bmp = BitmapFactory.decodeByteArray(photo, 0, photo.length, buffer);
hope to help you!
PS: SQS MY ENGLISH = (!!!
Sergio A.
source share