Animated GIF: every frame loads into video layers (#572) (#2999)

* feat(codecs): decode every frame of an animated GIF (#572)

decode_gif_frames returns each frame composited onto the logical screen
(disposal methods applied) with its delay in milliseconds. decode still
keeps the first frame only. A damaged later frame keeps the frames before
it and marks the first with DecodeWarning::Truncated; dimensions, the
total decoded bytes and a frame cap are checked against the limits.

* feat(io): import_gif_frames hands each GIF frame over as a document (#572)

A frame at a time becomes a single-layer document, so a caller can
flatten and drop it instead of holding every frame twice.

* feat(engine): animated GIFs load every frame into video layers (#572)

New Video Layer from File, Replace Footage, Reload Frame and Video Frames
to Layers take all frames of a GIF instead of the first. The timeline rate
comes from the GIF's delays (the most common one, delays under 20 ms shown
at 100 ms as browsers do); an explicit fps still wins.

* docs: animated GIF frames in video layers (#572)

---------

Co-authored-by: Brandon Thomas <echelon@gmail.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sir Starch
2026-10-12 01:26:37 -04:00
committed by GitHub
co-authored by Brandon Thomas Claude Opus 5.5
parent 61b6276c78
commit f14817a5d2
13 changed files with 497 additions and 13 deletions
+4 -1
View File
@@ -101,7 +101,10 @@ the same.
`DecodeWarning::MoreFrames` / `MorePages` in `Image::warnings`, with the total when the file
states it (frames and TIFF directories are counted without decoding them; reduced-resolution
TIFF directories and transparency masks are not pages). Any TIFF page can still be opened
with `decode_tiff_page` (and `photocraft_io::import_tiff_page`).
with `decode_tiff_page` (and `photocraft_io::import_tiff_page`). Every frame of a GIF comes
from `decode_gif_frames`: each frame composited onto the logical screen with the disposal
methods applied, as RGBA8 with its delay in milliseconds, within `Limits` and
`MAX_GIF_FRAMES`. The video-layer commands use it (`photocraft_io::import_gif_frames`).
* **EXIF in TIFF** is stored as a sub-IFD rather than a blob, so it is not preserved yet.
`caps.exif = false` for TIFF, and a warning is raised.
* **Orientation** (EXIF tag 274 in JPEG, PNG `eXIf` and WebP; the decoded page's tag in TIFF and