feat: Support GIF parsing#17
Merged
Merged
Conversation
There was a problem hiding this comment.
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
giffeature (enabled by default). - Adds GIF loading to the auto-loader and extends the CLI
convert --pageflow 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.
- 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.