Skip to content

feat: Support GIF parsing#17

Merged
ethanrous merged 5 commits into
mainfrom
gif-support
Apr 10, 2026
Merged

feat: Support GIF parsing#17
ethanrous merged 5 commits into
mainfrom
gif-support

Conversation

@ethanrous
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings April 9, 2026 02:44
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds GIF (multi-frame) decoding support to the agno crate, wiring it through the Rust API, CLI conversion flow, and Go/FFI surface so GIF frames can be loaded similarly to PDF pages.

Changes:

  • Introduces a native GIF decoder (including LZW decompression) and a public frame-count/frame-decode API behind a new gif feature (enabled by default).
  • Adds GIF loading to the auto-loader and extends the CLI convert --page flow to support GIF frames (with vertical stacking for multi-page/frame exports).
  • Updates the exported FFI/Go bindings to load “pages” from either PDF or GIF via a unified entry point, plus adds integration/unit tests for GIF decoding.

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
Cargo.lock Adds transitive crates for GIF support in dev/test (gif, weezl, color_quant).
bindings/go/agno/agno.h Updates generated header to expose load_image_page when PDF/GIF enabled.
bindings/go/agno/agno.go Enables AGNO_GIF and switches Go OpenPage to call load_image_page.
agno/tests/gif_decode_tests.rs Adds integration tests validating frame counts, decoding correctness, and loader bridging.
agno/src/main.rs Adds GIF --page conversion support and refactors page stacking into a shared helper.
agno/src/lib_interface.rs Replaces load_pdf_page with load_image_page and dispatches by file magic (PDF vs GIF).
agno/src/exif/mod.rs Treats GIF as EXIF-less (returns empty context).
agno/src/codec/mod.rs Adds codec::gif module behind the gif feature.
agno/src/codec/gif/mod.rs Defines public GIF codec API exports (decode_gif_frame, gif_frame_count).
agno/src/codec/gif/lzw.rs Implements GIF-specific LZW decompression with unit tests.
agno/src/codec/gif/decode.rs Implements GIF parsing, frame compositing/disposal handling, and decoding tests.
agno/src/agno_image/load/mod.rs Exposes new GIF loader module and re-exports its functions.
agno/src/agno_image/load/load.rs Extends type detection + auto-loader to support GIF (frame 0).
agno/src/agno_image/load/gif.rs Adds load_gif_frame_from_bytes bridging codec output into AgnoImage.
agno/cbindgen.toml Maps gif feature to AGNO_GIF for header generation.
agno/Cargo.toml Adds gif feature (default-enabled) and enables image dev-dep GIF support for tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread agno/src/lib_interface.rs
Comment thread agno/src/codec/gif/decode.rs Outdated
Comment thread agno/src/codec/gif/decode.rs Outdated
Comment thread agno/src/agno_image/load/load.rs
Comment thread agno/src/codec/gif/decode.rs
Comment thread agno/src/lib_interface.rs Outdated
Comment thread agno/src/main.rs Outdated
Comment thread agno/src/main.rs Outdated
- Change GIF magic check from 3-byte 'GIF' to exact 6-byte signature (GIF87a/GIF89a)
- Add frame index validation to prevent invalid indices
- Add GIF signature check in gif_frame_count

Also applies formatting fixes from cargo fmt.
@ethanrous ethanrous merged commit 366118e into main Apr 10, 2026
3 checks passed
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