我正在尝试使用Compressor库压缩图像,问题在于它会将Null返回给位图变量。
我的代码:
if (requestCode == GALLERY_PICK_CODE && resultCode == RESULT_OK) {
Uri chosenImageUri = data.getData();
File thumb_file = new File(chosenImageUri.getPath());
//getting Bitmap
Bitmap thumb_bitMap = new Compressor(this)
.setMaxWidth(640)
.setMaxHeight(480)
.setQuality(75)
.compressToBitmap(thumb_file);
Log.d("thumb_bm",String.valueOf( (thumb_bitMap==null) ) );
}
我已经检查并且 chosenImageUri 不为空
这里有没有人遇到过这个问题? 我该如何解决?