How to find resolution of video/image file in Android -
i want know resolution(height, width) of media file (video/image) in android.
i have file path , can stored in internal or external storage.
i came across apis mediastore
, media
etc. don't know how utilize them.
can tell me best efficient way retrieve meta info to the lowest degree overhead?
found way:
for video
mediametadataretriever mdr = new mediametadataretriever(); mdr.setdatasource("file_path"); int height = integer.parseint(mdr.extractmetadata(mediametadataretriver.metadata_key_video_height)); int width = integer.parseint(mdr.extractmetadata(mediametadataretriver.metadata_key_video_width));
for image
bitmap bitmap = bitmapfactory.decodefile("file_path"); bitmap.getheight(); bitmap.getwidth();
android
No comments:
Post a Comment