閱讀505 返回首頁    go 阿裏雲 go 技術社區[雲棲]


android2.2縮略圖類ThumbnailUtils

提供了四個對外的靜態接口
  1.
  Bitmap Android.media.ThumbnailUtils.createImageThumbnail(String filePath, int kind)
  This method first examines if the thumbnail embedded in EXIF is bigger than our target size. If not, then it'll create a thumbnail from original image. Due to efficiency consideration, we want to let MediaThumbRequest avoid calling this method twice for both kinds, so it only requests for MICRO_KIND and set saveImage to true. This method always returns a "square thumbnail" for MICRO_KIND thumbnail.
  Parameters:
  filePath the path of image file
  kind could be MINI_KIND or MICRO_KIND
  Returns:
  Bitmap
  @hide
  This method is only used by media framework and media provider internally.
  2.
  Bitmap android.media.ThumbnailUtils.createVideoThumbnail(String filePath, int kind)
  返回視頻縮略圖,如果視頻損壞或格式不被支持那麼都將返回為空
  filePath:視頻文件的位置
  kind:Images.Thumbnails.MICRO_KIND或者Images.Thumbnails.MINI_KIND最終和分辨率有關
  3.
  Bitmap android.media.ThumbnailUtils.extractThumbnail(Bitmap source, int width, int height)
  創建一個指定大小居中的縮略圖
  4.
  Bitmap android.media.ThumbnailUtils.extractThumbnail(Bitmap source, int width, int height, int options)
  創建一個指定大小居中的縮略圖,如果options定義為OPTIONS_RECYCLE_INPUT,則回收資源
  ThumbnailUtils類是API Level從8或更高才開始支持的,不向下兼容

最後更新:2017-04-02 17:09:29

  上一篇:go 基於Lucene的圖書全文搜索引擎
  下一篇:go c語言字符串函數