聊天平臺原始碼,通過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/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 聊天平臺原始碼,聊天平臺如何獲取到音訊流原始碼音訊
- 聊天平臺原始碼,登入時拼圖驗證原始碼
- org.reflections 介面通過反射獲取實現類原始碼研究反射原始碼
- 聊天平臺原始碼,TextView部分文字變色原始碼TextView
- PbootCMS上傳縮圖擷取尺寸縮小變模糊解決方案boot
- PbootCMS 上傳縮圖擷取尺寸縮小變模糊解決方案boot
- 獲取AOSP原始碼原始碼
- 通過用shellcode獲取shell
- 聊天平臺原始碼,標題過長自動應用摺疊式標題欄原始碼
- 聊天平臺原始碼,啟動異常進入recovery模式原始碼模式
- Grails通過sessionId獲取session物件AISession物件
- JavaScript 通過class獲取元素物件JavaScript物件
- HarmonyOS原始碼獲取大全原始碼
- 通過url動態獲取圖片大小方法總結
- 聊天平臺原始碼,解決設定導航欄按鈕圖片變色問題原始碼
- 聊天平臺原始碼,背景顯示使用仿磨砂玻璃樣式原始碼
- app直播原始碼,Vue獲取URL圖片的寬高APP原始碼Vue
- Universal-Image-Loader原始碼解解析---display過程 + 獲取bitmap過程原始碼
- QWebView獲取網頁原始碼WebView網頁原始碼
- 獲取openjdk10原始碼JDK原始碼
- C#獲取HTML原始碼C#HTML原始碼
- 短視訊平臺原始碼,獲取安卓手機驗證碼原始碼安卓
- 直播平臺原始碼,快速獲取當前狀態列高度原始碼
- 一對一聊天平臺原始碼,實現冪等的8種方案原始碼
- 聊天平臺原始碼,Android 解決menu彈出蓋住標題欄原始碼Android
- 通過身份證號碼獲取人的年齡和性別
- Flutter原始碼剖析(一):原始碼獲取與構建Flutter原始碼
- 直播平臺原始碼,vue圖片中劃框擷取部分圖片原始碼Vue
- 成品直播原始碼,JAVA獲取圖片的寬、高和大小原始碼Java
- 直播軟體原始碼,Vue獲取URL圖片的寬高原始碼Vue
- Android 通過名稱獲取資源IDAndroid
- 通過反射獲取私有內部類物件反射物件
- 通過web url獲取檔案資訊Web
- Unity通過子物件獲取父物件例子Unity物件
- 如何通過WinDbg獲取方法引數值
- android通過MediaProjection獲取螢幕內容AndroidProject
- JS中通過指定大小來壓縮圖片JS
- Glide 原始碼分析(一):圖片壓縮IDE原始碼