bumptech / glide

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

White background getting auto appended for avif image #5450

Open rajeevranjan-TUL-LF opened 4 days ago

rajeevranjan-TUL-LF commented 4 days ago

Glide Version: implementation 'com.github.bumptech.glide:glide:4.16.0'

Integration libraries: implementation 'com.github.bumptech.glide:avif-integration:4.14.2'

Device/Android Version: Android 12 and higher

Issue details / Repro steps / Use case background: white background getting appended in transparent images

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


@GlideModule
public class CustomAppGlideModule extends AppGlideModule {

    @Override
    public void applyOptions(Context context, GlideBuilder builder) {
        builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_ARGB_8888).disallowHardwareConfig());
        int bitmapPoolSizeBytes = 1024 * 1024 * 100; 
        builder.setBitmapPool(new LruBitmapPool(bitmapPoolSizeBytes));
        builder.setDiskCache(new ExternalPreferredCacheDiskCacheFactory(context));
        int memoryCacheSizeBytes = 1024 * 1024 * 100; 
        builder.setMemoryCache(new LruResourceCache(memoryCacheSizeBytes));
    }

    @Override
    public boolean isManifestParsingEnabled() {
        return false;
    }
}

private LazyHeaders imageRequestHeader = new LazyHeaders.Builder() 
            .addHeader("accept", "image/webp,img/avif,image/*")
            .build();

 GlideRequests glideRequests = GlideApp.with(context.getApplicationContext());
                RequestOptions requestOptions =
                        new RequestOptions().placeholder(ic_placeholder)
                                .diskCacheStrategy(DiskCacheStrategy.AUTOMATIC).dontTransform();
                glideRequests
                         .load(new GlideUrl(url, imageRequestHeader))
                        .skipMemoryCache(true)
                        .apply(requestOptions)
                        .into((ImageView) imageView).clearOnDetach();

Layout XML:

<FrameLayout xmlns:android="...

Stack trace / LogCat:

paste stack trace and/or log here
Screenshot 2024-09-24 at 5 13 25 PM