聊天平臺原始碼,通過MediaStore獲取縮圖模糊
聊天平臺原始碼,通過MediaStore獲取縮圖模糊實現的方法
獲取縮圖的方法
Bitmap thumbnail = Images.Thumbnails.getThumbnail(mContext.getContentResolver(), id, Images.Thumbnails.MICRO_KIND, null)
該方法為系統方法getThumbnail
/** * Return thumbnail representing a specific image item. If a * thumbnail doesn't exist, this method will block until it's * generated. Callers are responsible for their own in-memory * caching of returned values. * * As of {@link android.os.Build.VERSION_CODES#Q}, this output * of the thumbnail has correct rotation, don't need to rotate * it again. * * @param imageId the image item to obtain a thumbnail for. * @param kind optimal thumbnail size desired. * @return decoded thumbnail, or {@code null} if problem was * encountered. * @deprecated Callers should migrate to using * {@link ContentResolver#loadThumbnail}, since it * offers richer control over requested thumbnail sizes * and cancellation behavior. */ @Deprecated public static Bitmap getThumbnail(ContentResolver cr, long imageId, int kind, BitmapFactory.Options options) { final Uri uri = ContentUris.withAppendedId( Images.Media.EXTERNAL_CONTENT_URI, imageId); return InternalThumbnails.getThumbnail(cr, uri, kind, options); }
觀察到引數@param kind optimal thumbnail size desired
packages/providers/MediaProvider/apex/framework/java/android/provider/MediaStore.java public static class ThumbnailConstants { public static final int MINI_KIND = 1; public static final int FULL_SCREEN_KIND = 2; public static final int MICRO_KIND = 3; public static final Size MINI_SIZE = new Size(512, 384); public static final Size FULL_SCREEN_SIZE = new Size(1024, 786); public static final Size MICRO_SIZE = new Size(96, 96); public static @NonNull Size getKindSize(int kind) { if (kind == ThumbnailConstants.MICRO_KIND) { return ThumbnailConstants.MICRO_SIZE; } else if (kind == ThumbnailConstants.FULL_SCREEN_KIND) { return ThumbnailConstants.FULL_SCREEN_SIZE; } else if (kind == ThumbnailConstants.MINI_KIND) { return ThumbnailConstants.MINI_SIZE; } else { throw new IllegalArgumentException("Unsupported kind: " + } } }
因此,如要修改縮圖清晰度,可以修改第三個引數為MINI_KIND或FULL_SCREEN_KIND即可。
以上就是聊天平臺原始碼,通過MediaStore獲取縮圖模糊實現的方法, 更多內容歡迎關注之後的文章
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69978258/viewspace-2839699/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 聊天平臺原始碼,聊天平臺如何獲取到音訊流原始碼音訊
- 通過gitHub獲取vlc-Android原始碼GithubAndroid原始碼
- 聊天平臺原始碼,登入時拼圖驗證原始碼
- Android 原始碼獲取-----在Windows環境下通過Git得到Android原始碼Android原始碼WindowsGit
- org.reflections 介面通過反射獲取實現類原始碼研究反射原始碼
- 聊天平臺原始碼,TextView部分文字變色原始碼TextView
- PbootCMS上傳縮圖擷取尺寸縮小變模糊解決方案boot
- 通過PowerShell獲取Windows系統密碼HashWindows密碼
- 聊天平臺原始碼,啟動異常進入recovery模式原始碼模式
- 獲取AOSP原始碼原始碼
- 通過EPROCESS獲取程式名
- 聊天平臺原始碼,標題過長自動應用摺疊式標題欄原始碼
- C#中通過API呼叫獲取檔案圖示C#API
- 獲取img圖片原始尺寸程式碼例項
- javascript通過class屬性獲取元素的程式碼JavaScript
- 通過百度地圖獲取公交站點的程式碼例項地圖
- 聊天平臺原始碼,解決設定導航欄按鈕圖片變色問題原始碼
- JavaScript 通過class獲取元素物件JavaScript物件
- 通過用shellcode獲取shell
- HarmonyOS原始碼獲取大全原始碼
- 通過url動態獲取圖片大小方法總結
- 聊天平臺原始碼,背景顯示使用仿磨砂玻璃樣式原始碼
- 短視訊平臺原始碼,獲取安卓手機驗證碼原始碼安卓
- Grails通過sessionId獲取session物件AISession物件
- 通過web url獲取檔案資訊Web
- 通過反射獲取窗體例項反射
- 通過Java反射動態獲取資訊Java反射
- 用JavaScript獲取原始圖片尺寸JavaScript
- 通過url獲取圖片尺寸的幾種方法:JS和phpJSPHP
- QWebView獲取網頁原始碼WebView網頁原始碼
- 獲取openjdk10原始碼JDK原始碼
- C#獲取HTML原始碼C#HTML原始碼
- app直播原始碼,Vue獲取URL圖片的寬高APP原始碼Vue
- 一對一聊天平臺原始碼,實現冪等的8種方案原始碼
- [譯] 通過後臺資料預獲取技術實現效能提升
- 直播平臺原始碼,快速獲取當前狀態列高度原始碼
- 批次過程獲取指令碼指令碼
- 從原始碼來聊一聊hashmap原始碼HashMap