1. 程式人生 > >android獲取圖片原始長寬,獲取視訊第一幀的縮圖

android獲取圖片原始長寬,獲取視訊第一幀的縮圖

public static Bitmap getVideoThumbnail(String videoPath) { MediaMetadataRetriever media =new MediaMetadataRetriever(); media.setDataSource(videoPath); Bitmap bitmap = media.getFrameAtTime(); return bitmap; } public static Bitmap getVideoThumbnail(String videoPath,int width,int height,int
kind) { Bitmap bitmap =null; bitmap = ThumbnailUtils.createVideoThumbnail(videoPath, kind); bitmap = ThumbnailUtils.extractThumbnail(bitmap, width, height, ThumbnailUtils.OPTIONS_RECYCLE_INPUT); return bitmap; }