[问题] 读取图片GIF错误Image failed to decode

楼主: linlin76 (linlin76)   2017-02-15 21:38:10
目前使用这个lib处理照片裁切
https://github.com/oginotihiro/cropview
可是选取照片时,如果选到GIF就会闪退
看一下程式码
主要是死在
InputStream is = context.getContentResolver().openInputStream(sourceUri);
BitmapRegionDecoder decoder = BitmapRegionDecoder.newInstance(is, false);
以上程式码sourceUri如果抓到图档是GIF就会跳
Image failed to decode using JPEG decoder
原本想说去判断Uri看是不是GIF再另外处理
可是我看Uri是乱码
(sourceUri = content://com.android.providers.media.documents/document/image%3A22486)
这样我可以怎么处理@@?
作者: givemepass (λ)   2017-02-21 22:09:00
你可能要先解URI 转换成路径在做副档名判断即可请参考 https://goo.gl/7bwTlX 里面有一段getPath

Links booklink

Contact Us: admin [ a t ] ucptt.com