Skip to content

export: write animated GIFs with the shared craft-gif writer (#778) - #3671

Merged
FredApps merged 6 commits into
mainfrom
codex/gif-writer-consumer
Nov 16, 2026
Merged

FredApps merged 6 commits into
mainfrom
codex/gif-writer-consumer

Conversation

@dylanmtaylor

@dylanmtaylor dylanmtaylor commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

Part of storytold/craft-libs#778.

Summary

  • GIF export goes through craft_gif::write (AnimationWriter, prepare_frame) instead of using the gif crate directly. gif stays as a dev-dependency for the round-trip tests.
  • Behaviour is unchanged. Delays carry the rounding error as before, RGBA output uses background disposal, gif_loop picks infinite or no looping, and frames over 65,535 px keep the existing Unsupported error. Encoder errors from prepare_frame and finish are now reported instead of being dropped.
  • craft-gif is pinned to 948b5c23 on craft-libs main.

Tests

  • gif_roundtrip also checks looping and disposal.
  • gif_matches_the_former_encoder_byte_for_byte re-encodes the same rendered frames through the former gif 0.13 path and requires identical bytes.
  • gif_rgba_keeps_background_disposal_and_non_looping covers the RGBA and non-looping path.
  • gif_dimension_limit_keeps_the_existing_unsupported_error.

cargo test -p effectcraft-export gif passes.

Summary by CodeRabbit

  • Bug Fixes
    • GIF exports preserve frame timing and match the established output format.
    • GIFs with RGBA frames use background disposal; other frames retain their existing disposal behavior.
    • Exported animations retain the expected looping behavior.
    • GIF dimensions above the supported 65,535-pixel limit are rejected with an unsupported-format error.
  • Tests
    • Added checks for GIF output compatibility, disposal settings, looping behavior, and dimension limits.

@coderabbitai

coderabbitai Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Explain Change →

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • Resume reviews
  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The workspace updates its pinned craft-gif revision. GIF export now uses craft-gif to prepare and write frames. The change adds dimension validation and tests for output bytes, looping, and disposal behavior. Integration tests also use a shared WAV fixture helper.

Changes: GIF export and test updates

Layer / File(s) Summary
Migrate GIF export and verify output
Cargo.toml, crates/export/Cargo.toml, crates/export/src/lib.rs, crates/export/tests/it/roundtrip.rs
The export crate adds craft-gif as a regular dependency and moves gif to dev-dependencies. GIF export validates dimensions and uses craft-gif to prepare and write frames. Tests check dimension limits, disposal, looping, and byte parity.
Share integration-test audio fixture
crates/export/tests/it/main.rs, crates/export/tests/it/support.rs, crates/export/tests/it/hevc_av1_roundtrip.rs, crates/export/tests/it/roundtrip.rs, crates/export/tests/it/uncompressed_mov.rs
Integration tests use a shared WAV-writing helper instead of separate local implementations.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Refactor

Suggested reviewers: vangel76, echelon

Merge Risk: Minimal · up to 089c3

GIF export moves to the craft-gif library with output unchanged and errors now reported. Tests cover the key behaviors, and no merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: animated GIF export in the export crate now uses the shared craft-gif writer. The raw summary confirms that gif_export switches to craft_gif's animation writer, and th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: animated GIF export in the export crate now uses the shared craft-gif writer. The raw summary confirms that gif_export switches to craft_gif's animation writer, and the objectives state the same. The title is specific and matches the changeset, so it passes. The (#778) reference is a PR number and does not affect the assessment.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 11ac2ad and 089c357.

Files selected for processing: 5

  • crates/export/tests/it/hevc_av1_roundtrip.rs
  • crates/export/tests/it/main.rs
  • crates/export/tests/it/roundtrip.rs
  • crates/export/tests/it/support.rs
  • crates/export/tests/it/uncompressed_mov.rs

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

dylanmtaylor and others added 3 commits November 15, 2026 14:13
…ests

Split the byte-parity check against the former gif 0.13 encoder into its own
test, with the reference encode in a helper.
@FredApps FredApps changed the title WIP: codex/gif-writer-consumer (#778) export: write animated GIFs with the shared craft-gif writer (#778) Nov 16, 2026
@sonarqubecloud

Copy link
Copy Markdown

@FredApps FredApps left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI and the SonarCloud quality gate are green at 089c357, and there are no open threads. The GIF writer cutover is unchanged in behaviour and checked byte for byte against the former encoder.

@FredApps
FredApps merged commit f6fdd27 into main Nov 16, 2026
12 checks passed
@FredApps

FredApps commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Thanks @dylanmtaylor! GIF export now goes through the shared craft_gif::write writer instead of the gif crate. It's byte-for-byte identical to the former encoder, keeps looping and disposal, and now reports encoder errors instead of dropping them. One more piece of storytold/craft-libs#778 moved into craft-libs.

FredApps added a commit that referenced this pull request Nov 16, 2026
Take #3671's shared GIF writer (craft-gif) in export. Keep workspace
craft-libs pins at 5a7a63a2, which already includes that writer revision.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants