Skip to content

Gif is decoded as 1 frame animation #801

@5ALEKSEY

Description

@5ALEKSEY

Hello 😇

I've found an issue on my working project. I have faced with a problem when some of our GIF display incorrectly.

I've investigated and found out that:

  1. SampleSize doesn't work if the value grater then 1 was passed
    (But as I see, you are already know it and even managed to fix 👍 Waiting for the release)
  2. GIF is decoded as 1 frame animation.

Let's talk about second one.

Our GifDrawable creating has next steps:

GifOptions gifOptions = new GifOptions();
gifOptions.setInSampleSize(gifInSampleSize); // 'gifInSampleSize' was calculated before
drawable = new GifDrawableBuilder()
            .from(mContext.getContentResolver(), gifUri)
            .options(gifOptions)
            .build();
drawable.setLoopCount(0);

As the result GifDrawable is: GIF: size: 1999x1999, frames: 1, error: 107

Here we can see 107 error and only 1 fetched frame (but actually it has more frames 😞)

About GIF. Nothing special here except of "why is it so big??? 🙃".
Yes, it is really big. And, btw, gifInSampleSize = 4 here 🤫
It was found during the testing of different sizes.

How was this GIF born:

I request you help in case of at least explanation "why it was decoded as 1 frame". I don't know, probably, online converter made it's own dirty monkey tricks and GIF file become broken. So, I would appreciate any of your help and explanation here.

P.S. I have tested this gif with your sample project and added this 'broken' GIF to drawable resources. Result is the same. You can reproduce it by yourself, I'll attach it.
P.P.S. GIF playing is okey for my PC (more than 1 frame animation)

broken_cat.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions