bitmapfactory.decodefile()在内存中存在文件时返回null

发布于 2025-01-29 16:12:07 字数 746 浏览 2 评论 0原文

我在内部内存中有以下JPG映像,但是bitmapfactory.decodefile返回null

“在此处输入图像说明”

   File imgFile = new  File("/data/user/0/com.arthenica.ffmpegkit.test/files/t.jpg");
   // same result for `File imgFile = new  File(getContext().getFilesDir(), "t.jpg");`
   Bitmap bitmap = null;
   if(imgFile.exists()){
      BitmapFactory.Options bmOptions = new BitmapFactory.Options();
      bitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath(), bmOptions); // null
   }

它可以检测到该imgfile ,但返回值为null。有人知道可能是什么原因吗?

I have the following jpg image in the internal memory, but BitmapFactory.decodeFile returns null:

enter image description here

   File imgFile = new  File("/data/user/0/com.arthenica.ffmpegkit.test/files/t.jpg");
   // same result for `File imgFile = new  File(getContext().getFilesDir(), "t.jpg");`
   Bitmap bitmap = null;
   if(imgFile.exists()){
      BitmapFactory.Options bmOptions = new BitmapFactory.Options();
      bitmap = BitmapFactory.decodeFile(imgFile.getAbsolutePath(), bmOptions); // null
   }

It can detect that imgFile exists, but the return value is null. Does anyone know what might be the reason?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文