I want to know the size of an image stored in a byte array in KB
Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.mPicture); ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.JPEG, 100, baos);
The following logs display two different results for an 11.7KB image:
Log.d(TAG, "bm size: " + bm.getByteCount()/1024); // 942 Log.d(TAG, "baos size: " + baos.size()/1024); // 81 Log.d(TAG, "byte size: " + b.length/1024); // 81
What is the correct result or how do I get the correct result? Any help is appreciated.
user595349
source share