How get bitmap dimension without loading Android example

Bitmap Width, Height without memory allocation:

BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeResource(getResources(), R.id.myimage, options);
// now opts.outWidth and opts.outHeight are the dimension of the
// bitmap, even though Bitmap is null
int imageHeight = options.outHeight;
int imageWidth = options.outWidth;
String imageType = options.outMimeType;
This entry was posted in Android Examples Code, Bitmap, drawing and tagged , . Bookmark the permalink.


Comments are closed.



2,849 views