bumptech / glide

An image loading and caching library for Android focused on smooth scrolling
https://bumptech.github.io/glide/
Other
34.59k stars 6.12k forks source link

AVIF support not working properly #4763

Open tronku opened 2 years ago

tronku commented 2 years ago

Glide Version: 4.13.0, 4.13.1

Integration libraries: okHttp - 4.9.0

Device/Android Version: Samsung Fold/A12

Issue details / Repro steps / Use case background: Added avif integration dependency but getting black instead of transparency for the PNGs.

Screenshot 2022-03-13 at 4 38 51 PM

Similar issue has been created on AOMediaCodec which is being used by Glide - https://github.com/AOMediaCodec/libavif/issues/876

Glide load line / GlideModule (if any) / list Adapter code (if any):

RequestBuilder<Bitmap> mainRequestBuilder = GlideApp.with(imageView)
                .asBitmap()
                .load(mainURL)
                .thumbnail(GlideApp.with(imageView).asBitmap().load(thumbUrl).apply(requestOptions))
                .apply(requestOptions)
                .listener(new MyImageLoadListener(listener));

Have also tested the AVIF on Glide's sample app too, getting the same error.

Layout XML:

<FrameLayout xmlns:android="...

Stack trace / LogCat:

paste stack trace and/or log here
vigneshvg commented 2 years ago

Hi,

Are you trying to load an AVIF file or a PNG file? If you are loading a PNG file, the AVIF integration should have no effect on how that is loaded. The file that you have attached seems to be a PNG file.

tronku commented 2 years ago

Hey @vigneshvg, cdn providers convert the images into the requested format so they are giving us the avif formats only, but glide is not able to handle the transparency I guess. I read that AVIF is suitable for transparency as well.

vigneshvg commented 2 years ago

Hey @vigneshvg, cdn providers convert the images into the requested format so they are giving us the avif formats only, but glide is not able to handle the transparency I guess. I read that AVIF is suitable for transparency as well.

The AVIF glide extension should be able to handle AVIF images with alpha transparency as it outputs to an RGBA_8888 Bitmap.

I am still not sure if you are trying to load an AVIF image or a PNG image. If it is an AVIF image, is there any way you can attach the image so that i can take a look at why it is not loading?

tronku commented 2 years ago

Sure, here's a test AVIF file - https://raw.githubusercontent.com/ZAsheesh/Test/main/a.avif

vigneshvg commented 2 years ago

Sure, here's a test AVIF file - https://raw.githubusercontent.com/ZAsheesh/Test/main/a.avif

Thank you, i will take a look.

vigneshvg commented 2 years ago

Sure, here's a test AVIF file - https://raw.githubusercontent.com/ZAsheesh/Test/main/a.avif

I am able to load this image file successfully with the Glide AVIF integration. Is there a specific error message that you see?

tronku commented 2 years ago

yeahh it's working fine on 4.13.1

tronku commented 2 years ago

@vigneshvg noticed that the image caching is different in 4.13.0 and 4.13.1. If I am on 4.13.1 then if i move back to 4.13.0 then i am getting loading issues unless i clear the image cache manually. Can you please check for the compatibility or at least mention that somewhere?

vigneshvg commented 2 years ago

Tagged release 4.13.2 should fix AVIF related issues: https://github.com/bumptech/glide/releases/tag/v4.13.2

karlhorky commented 5 months ago

Seems like v4.13.2 was released on May 4, 2022 - @vigneshvg @tronku should this issue be closed now?