koral-- / android-gif-drawable

Views and Drawable for displaying animated GIFs on Android
Other
9.56k stars 1.78k forks source link

seekToFrameAndGet with subsampling returns blank bitmap #797

Closed crowbarsolutions closed 2 years ago

crowbarsolutions commented 2 years ago

Using version 1.2.24

GifDrawableBuilder builder = new GifDrawableBuilder();
builder.sampleSize(2);
builder.from(methodThatReturnsBufferedInputStream());       
GifDrawable gifFromBytes = builder.build();
Bitmap bs = gifFromBytes.seekToFrameAndGet(0);
gifFromBytes.recycle();

The resulting bitmap is blank (all black) when I use sampleSize with any parameter greater than 1. With sampleSize set to 1 I am getting the correct bitmap. I am using this GIF to test with: https://crowbarsolutions.com/test/content/test.gif

This issue doesn't happen when using version 1.2.19 but happens when you use any version after that.

koral-- commented 2 years ago

Thanks for the report, I was able to reproduce that. It seems that subsampling gets broken at all. Will try to fix it ASAP.