-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
[4.13.2] Transparent layer is not working with Avif #4807
Comments
Hi, Thanks for the detailed bug report. The AVIF integration supports images with alpha channel. Do you have an AppGlideModule to activate the AVIF integration? Without the AppGlideModule, Glide will try to decode the AVIF images using the platform's AVIF decoder (it will be available on android versions >= 12). The platform decoder does NOT support alpha channel and would result in images being rendered as you have shared. A sample empty app glide module: @GlideModule
public final class YourAppGlideModule extends AppGlideModule {} I am able to reproduce this on my pixel 3. Without the app glide module, i see images rendered similar to yours. With the app glide module, i see the images rendered correctly with transparency based on whether or not dark mode is enabled in the system settings. Here is how it renders on my Pixel 3 with the correct app glide module. Light Mode: Dark Mode: Hope that helps. Please let me know if you have any further questions. |
same problem with this file,on system version below android 12 |
@vigneshvg // ...
val target = glideTarget(tariffImage) ?: object : CustomViewTarget<ImageView, Drawable>(myImageView) {
override fun onResourceReady(resource: Drawable, transition: Transition<in Drawable>?) {
getView().setImageDrawable(resource)
}
override fun onLoadFailed(errorDrawable: Drawable?) {
// no-op
}
override fun onResourceCleared(placeholder: Drawable?) {
// no-op
}
}
saveTarget(tariffImage, target)
Glide.with(myImageView)
.load(iconUrl)
.into(target)
}
// ...
private fun saveTarget(view: View, glideTarget: Target<Drawable>) {
view.setTag(R.id.image_view_tag_glide_target, glideTarget)
}
private fun glideTarget(view: View): Target<Drawable>? {
return view.getTag(R.id.image_view_tag_glide_target) as? Target<Drawable>
} That example shows white background for AVIF. But I watched througth the source code and found interesting moment with ImageView: |
I use glide
4.13.2
with avif supportbut I am stuck with transparent layer. All images got problems with background: green, black or problems with displaying.
Example avifs with device output
All avifs and device output screens
How Glide renders it on my Pixel 5
You can find all avifs by link above.
Device: Pixel 5 Android 12
Is it a known problem? I saw the similar problem in #4751
The text was updated successfully, but these errors were encountered: