Skip to content

Support image animations #24855

@vrabaud

Description

@vrabaud

Describe the feature and motivation

Several formats (e.g. GIF, WebP, AVIF) support animations. Those are different from multi-page files (like TIFF) as there is a bit more information like frame duration or loop count.
VideoCapture can read them though the FFMPEG backend but this is a heavy dependency when imgcodecs already depends on those image libraries.
VideoWriter does not support writing animations as it relies on FOURCC (video only).

I propose the following solution:

  • add an imreadanimation/imdecodeanimation/imwriteanimation in imgcodecs
  • the API also includes the frame durations (vector<int>) and loop count

Support for WebP, AVIF, APNG can easily be added as the libraries are already linked to. GIF is harder and the GIF API is hard to use.

Maybe that could be a GSOC idea?

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions