Closed hgourvest closed 1 year ago
After investigating, it is an expected behaviour, I would like to know why.
I removed the limitation commenting code in seekToFrame jni method and it works as expected. I am missing something ?
What does "not decoded" mean? Share a reproducer project and describe the desired behavior.
I only use GifDecoder class. The bitmap stay black when there is only one frame.
try (final FileInputStream stream = new FileInputStream(cache)) { BufferedInputStream buffStream = new BufferedInputStream(stream); GifDecoder decoder = new GifDecoder(new InputSource.InputStreamSource(buffStream)); int framesCount = decoder.getNumberOfFrames(); if (framesCount > 0) { bmp = Bitmap.createBitmap(decoder.getWidth(), decoder.getHeight(), Bitmap.Config.ARGB_8888); for (int i = 0; i < framesCount; i++) { decoder.seekToFrame(i, bmp); } bmp.recycle(); } }
The problem is here
Thanks, now I get it. AFAIK that check was one of optimizations for GifDrawable as it naturally always points to some frame and seeking in still images is no-op there. Use case like yours was not anticipated. I'll check that and update the code soon.
Thanks
this file is not decoded, it's a gif image with a single frame