Android2.2缩略图类ThumbnailUtils简述

android.media.ThumbnailUtils提供了三个对外的静态接口,使用此类进行缩略图大小调整非常方便,省去了自己缩放。而且非常节省内存资源。

1. public static Bitmap createVideoThumbnail (String filePath, int kind)
Create a video thumbnail for a video. May return null if the video is corrupt or the format is not supported.

译:返回视频缩略图,如果视频损坏或格式不被支持那么都将返回为空 

Parameters
filePath            the path of video file(视频文件路径)

kind                 could be MINI_KIND or MICRO_KIND

                       (缩略图类型  MINI_KIND: 512 x 384 thumbnail , MICRO_KIND: 96 x 96 thumbnail)

                       

2. public static Bitmap extractThumbnail (Bitmap source, int width, int height, int options)

Creates a centered bitmap of the desired size.

译:创建一个指定大小居中的缩略图,如果options定义为OPTIONS_RECYCLE_INPUT,则回收资源 

Parameters
source             original  bitmap source(原始Bitmap源文件)
width               targeted width(指定宽度)
height              targeted height(指定高度)
options            options used during thumbnail extraction(输出选项)

3. public static Bitmap extractThumbnail (Bitmap source, int width, int height)

Creates a centered bitmap of the desired size.

译:创建一个指定大小居中的缩略图

Parameters
source            original bitmap source(原始Bitmap源文件)
width              targeted width(指定宽度)
height             targeted height(指定高度)

ThumbnailUtils类是API Level从8或更高才开始支持的,不向下兼容

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值