Picasso为PNG文件打印JPG错误

时间:2016-10-13 16:37:40

标签: android picasso

我的应用程序工作正常但我在日志中发现了一些奇怪的东西。当我打开刚刚生成Picasso打印的PNG文件时,打开JPEG图像会遇到麻烦:

10-13 18:15:41.883 10275-10615/lelisoft.com.lelimath.debug I/ExifInterface_JNI: Raw image not detected
10-13 18:15:41.885 10275-10615/lelisoft.com.lelimath.debug W/ExifInterface: Invalid image: ExifInterface got an unsupported image format file(ExifInterface supports JPEG and some RAW image formats only) or a corrupted JPEG file to ExifInterface.
at android.media.ExifInterface.getJpegAttributes(ExifInterface.java:1830)
at android.media.ExifInterface.loadAttributes(ExifInterface.java:1474)
at android.media.ExifInterface.<init>(ExifInterface.java:1111)
at com.squareup.picasso.FileRequestHandler.getFileExifRotation(FileRequestHandler.java:46)
at com.squareup.picasso.FileRequestHandler.load(FileRequestHandler.java:42)
at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:206)
at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:159)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:428)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
at java.lang.Thread.run(Thread.java:761)
at com.squareup.picasso.Utils$PicassoThread.run(Utils.java:411)

图片是通过以下方式生成的:

File file = new File(getContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES), figure.getId() + ".png");
fos = new FileOutputStream(file);
log.debug("Saving picture bitmap to " + file.getAbsolutePath());
bmp.compress(Bitmap.CompressFormat.PNG, 95, fos);
fos.close();

图片加载了以下代码:

File file = new File(getContext().getExternalFilesDir(Environment.DIRECTORY_PICTURES), figure + ".png");
if (file.exists()) {
    Picasso.with(getContext()).load(file).into(view);
} else {
    Picasso.with(getContext()).load(resource).into(view);
}

我下载了这张图片,我可以在二进制视图中看到PNG标题。 Windows可以打开它,XnView失败。知道那里有什么问题吗?

generated file

0 个答案:

没有答案