Certain GIFs display red rectangles after 3.7
- Dominant language
- Java
- Stars
- 35k
- Forks
- 6.2k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 8
Description
**Glide Version**: >3.7
**Integration libraries**: None
**Device/Android Version**: Any
**Issue details / Repro steps / Use case background**:
We use Glide to load a GIF over a static image to display a weather/cloud/rain map of the Netherlands.
This GIF is put together by a third party, and is used by our website, Android and iOS app. After upgrading from Glide <=3.7, we started noticing the issue (see video below): on some GIFs, a red rectangle (or more) appears after some time.
I've traced the issue to commit e15172ef12d746565de85427fc3cfc2d51f40645, where the full erasure of the previous frame was replaced with a local restore of bgColor.
Ever since this commit, these mysterious red rectangles appear. I believe our supplier sends a slightly malformed GIF that worked fine with the full erasure, but fails with the partial (my guess would be that the bgColor is set to red). I've also attached a GIF displaying this issue.
I'm not saying this is a strictly Glide issue, most likely our provider has been supplying us with these slightly malformed images, but due to the old way of handling erasure, it was never discovered. I'm opening this ticket to get some answers regarding how exactly the erasure is supposed to work, and what technical parameters we should send to our supplier to fix this problem.
**Glide load line / `GlideModule` (if any) / list Adapter code (if any)**:
```java
@BindingAdapter(value = {"gif_url", "placeholder", "gif_id"}, requireAll = false)
public static void loadGif(final ImageView imageView, final String url, final Drawable imagePlaceholder, final String gif_id) {
if (imageView == null) {
return;
}
Runnable runnable = () -> {
GifTypeRequest requestBuilder = Glide.with(imageView.getContext()).load(url).asGif();
requestBuilder.diskCacheStrategy(DiskCacheStrategy.SOURCE);
requestBuilder.signature(new StringSignature(TextUtils.isEmpty(gif_id) ? "" : gif_id));
if (imagePlaceholder != null) {
requestBuilder.placeholder(imagePlaceholder);
}
requestBuilder.into(imageView);
};
imageView.post(runnable);
}
```
**Layout XML**: irrelevant for the bug
See [here](https://imgur.com/a/Be0yJM0)
Gif in question (GitHub might've modified it during upload):

Contributor guide
Assessment
This issue has not been assessed yet.