Set the Options.inJustDecodeBounds to true and call the
BitmapFactory's method to get/decode your bitmap. The bitmap returned
will be null, but the Options.outWidth and Options.outHeight will be
set to the image's width and height in pixels.


Then call the BitmapFactory's method to get/decode your bitmap again,
with Options.inJustDecodeBounds set to false and its inSampleSize set
to your liking.

BTW: This is all in the documentation:
http://developer.android.com/reference/android/graphics/BitmapFactory.Options.html#inJustDecodeBounds


On Jun 4, 4:37 am, quill <[email protected]> wrote:
> Hi all,
> I want to know an image's width before decode it, so that I can set
> Options.inSampleSize if the image is too large. Any advice to do that?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to