Incorrect image dimensions in android when using Bitmap
<p>I have.png image file stored as a resource in my android application. 
In my code, i am allocationg new Bitmap instance from that image as follow:</p>

<pre><code>Bitmap img = BitmapFactory.decodeResource(getResources(), R.drawable.imgName);
</code></pre>

<p>But when I read the image dimensions from the Bitmap object using getWight() and getHeight() methods, </p>

<pre><code>int width = img.getWidth();
int height = img.getHeight();
</code></pre>

<p>I am getting different results from the original image... Can some one explain me what am I missing, and how can I retreive the image size?</p>

<p>(My project is complied with android 2.2 - API 8)</p>

<p>Edit:
Ok - found out how to get the real dimensions:
setting <code>inJustDecodeBounds</code> property of the <code>BitmapFactory.Options</code> class to true as follow:</p>

<pre><code>BitmapFactory.Options options = new BitmapFactory.Options();
    options.inJustDecodeBounds = true;
    BitmapFactory.decodeResource(getResources(), R.drawable.imgName, options);
    width = options.outWidth;
    height = options.outHeight;
</code></pre>

<p>The problem now is that the decoder returns null when we send <code>Options</code> argument, so I need to decode again like I did before (without <code>Options</code> argument...) to retrieve <code>Bitmap</code> instance -bizarre, isnt it?</p>
