I have images in sdcard , ie a sample png has 701 x 438 size. the size i want to retrieve in my app before putting in ImageView
.
How to get this actual size of image in your java code?
I mean width and height which is actual to image.
You cab also use BitmapRegionDecoder
to get actual height and width of image in form of Bitmap.
BitmapRegionDecoder bitmapRegionDecoder = newInstance( pathName, isShareable);
Create a BitmapRegionDecoder
from a file path.
use below methods to get height and width:
int getHeight()
Returns the original image's height
int getWidth()
Returns the original image's width
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.