Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

加载一个大图,缩小之后会出现失真的情况 #83

Open
w4901 opened this issue Jun 23, 2021 · 7 comments
Open

加载一个大图,缩小之后会出现失真的情况 #83

w4901 opened this issue Jun 23, 2021 · 7 comments
Labels

Comments

@w4901
Copy link

w4901 commented Jun 23, 2021

加载一个大图,缩小之后会出现失真的情况
如果需要,我可以提供一个webp

@zjupure
Copy link
Owner

zjupure commented Jun 24, 2021

提供下sample代码和webp图片,失真的截图。缩小是什么意思

@w4901
Copy link
Author

w4901 commented Jun 25, 2021

Glide.with(this).load(R.drawable.head2).into(iv2);
布局代码。

@w4901
Copy link
Author

w4901 commented Jun 25, 2021

head.webp.zip
device-2021-06-25-092733.mp4.zip资源,和图片加载的录屏,加载之后,webp上会出现黑色的横线 缩小就是image的大小比webp大小要小一些,同一个资源,放大就不会有问题 @zjupure

@zjupure
Copy link
Owner

zjupure commented Jul 10, 2021

大致看了下,应该是libwebp降采样解码的bug,需要给google反馈下

@w4901
Copy link
Author

w4901 commented Jul 10, 2021

我这边试了一下,renderFrame的时候,先获取原尺寸图,在通过BitmapFactory降低采样率,就不会出这个问题,但是cpu占用相应会高。
image
@zjupure

@zjupure
Copy link
Owner

zjupure commented Jul 10, 2021

我这边试了一下,renderFrame的时候,先获取原尺寸图,在通过BitmapFactory降低采样率,就不会出这个问题,但是cpu占用相应会高。
image
@zjupure

这样是利用Android Bitmap解码png的能力,不推荐这么做,2次解码了,cpu和性能都有影响;解码原图后,直接Bitmap scale下更快,只是内存占用会多点,缓存有上限,没有极端webp图应该还好。影响你们APP功能使用的话,可以这样改workaround下。
我给google提issue了:https://bugs.chromium.org/p/webp/issues/detail?id=531

@w4901
Copy link
Author

w4901 commented Jul 10, 2021

scale 好像也会出现不一样的问题,之前试过了,但是具体效果记不清了。

@zjupure zjupure added the bug label Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants