Skip to content

Flutter's GIF renderer is too compatible with the GIF89a spec #130684

Closed as not planned

Description

@evoL

Is there an existing issue for this?

Steps to reproduce

I apologize for the clickbaity title, but the opportunity was too good to pass.

The issue is that, unlike all other GIF renderers out there, Flutter's GIF renderer actually renders frames with the specified delay, even if it's 0 or 10ms (0 or 1 in the GIF file). While this behavior conforms to the GIF89a spec, the problem is that everybody else doesn't conform — such short delays are usually artificially set to 100ms.

You can read more about this fascinating phenomenon in this article: https://www.biphelps.com/blog/The-Fastest-GIF-Does-Not-Exist. The article contains example GIFs and is a deep dive into the topic.

Because of this behavior, there are already GIFs in the wild that render too fast in Flutter. I think it would make sense to align with the rest of the world, just to existing files render the same as everywhere else.

Expected results

Frames with the delay set to 0 (0ms) or 1 (10ms) have their delay expanded to 100ms.

Actual results

The frames are rendered so fast, they're imperceptible.

Code sample

Code sample

In this example, I've used the smallest GIF from the article mentioned above and added sliders to customize the delays of frames with black and red cells.

This is a customizable equivalent to the "No Delay" section of said article.

https://dartpad.dev/?id=00398769300a9e28c231ba37615828af

Screenshots or Video

Screenshots / Video demonstration

These images come from the article mentioned above.

Flutter's (spec-conformant) behavior.

Flutter's (spec-conformant) behavior

The actual GIF as rendered by your current browser

The actual GIF as rendered by your current browser

Logs

No response

Flutter Doctor output

Doctor output
[✓] Flutter (Channel stable, 3.10.5, on macOS 13.4.1 22F770820d darwin-arm64, locale pl-CH)
    • Flutter version 3.10.5 on channel stable at /Users/evol/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 796c8ef792 (5 weeks ago), 2023-06-13 15:51:02 -0700
    • Engine revision 45f6e00911
    • Dart version 3.0.5
    • DevTools version 2.23.1

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0-rc2)
    • Android SDK at /Users/evol/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0-rc2
    • Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.3.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14E300c
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2022.2)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b802.4-9586694)

[✓] IntelliJ IDEA Community Edition (version 2023.1.1)
    • IntelliJ at /Applications/IntelliJ IDEA CE.app
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart

[✓] VS Code (version 1.80.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (2 available)
    • macOS (desktop) • macos  • darwin-arm64   • macOS 13.4.1 22F770820d darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 114.0.5735.198

[✓] Network resources
    • All expected network resources are available.

• No issues found!

Activity

  1. moffatman commented on Jul 16, 2023

    @moffatman
    Contributor

    Related: #80030

    Personally I just fix it in my personal fork by applying the above

  2. TKDev7 commented on Jul 17, 2023

    @TKDev7

    This looks like a duplicate of #29130

  3. added
    in triagePresently being triaged by the triage team
    on Jul 17, 2023
  4. huycozy commented on Jul 17, 2023

    @huycozy
    Member

    Hi @evoL
    I'm not familiar with GIF89a specs. Can you check the linked issue above #29130 if it's similar to this case?

  5. added
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jul 17, 2023
  6. evoL commented on Jul 17, 2023

    @evoL
    Author

    Hey, #29130 does look like the same thing. Feel free to mark this as a duplicate.

    Thanks everybody for letting me know!

  7. removed
    waiting for responseThe Flutter team cannot make further progress on this issue until the original reporter responds
    on Jul 17, 2023
  8. added
    r: duplicateIssue is closed as a duplicate of an existing issue
    and removed
    in triagePresently being triaged by the triage team
    on Jul 17, 2023
  9. github-actions commented on Jul 31, 2023

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  10. locked as resolved and limited conversation to collaborators on Jul 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    r: duplicateIssue is closed as a duplicate of an existing issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions