How to get size of an image that is held in a byte array in KB
<p>I want to find out the size of an image that is held in a byte array in KB </p>

<pre><code>Bitmap bm = BitmapFactory.decodeResource(getResources(), R.drawable.mPicture);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bm.compress(Bitmap.CompressFormat.JPEG, 100, baos); //bm is the bitmap object   
byte[] b = baos.toByteArray();
</code></pre>

<p>The following logs display two different results for an image that is <b>11.7KB</b>:</p>

<pre><code>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
</code></pre>

<p>Which is the correct result or how do I get the correct result?? Any help is appreciated.</p>
