GIF Maker is a small Rust terminal app for turning a folder of image frames into an animated GIF. It uses a Ratatui interface for controls, scans local image files, and writes a looping GIF.
- Reads frames from
example/framesby default - Lets you choose a custom input folder from the terminal UI
- Supports
png,jpg, andjpeginput files - Sorts frame files by path before encoding
- Resizes every frame to match the first image
- Encodes an infinitely looping GIF to
./output.gif - Lets you adjust FPS from the terminal UI
- Rust toolchain with the 2024 edition support
- A folder of image frames named in sortable order, for example:
example/frames/
frame_001.png
frame_002.png
frame_003.png
Use zero-padded file names so the sorted file order matches the intended animation order.
Create the default input directory and add frames:
mkdir -p examples/frames
cp /path/to/images/* examples/frames/Run the app:
cargo runInside the TUI:
| Key | Action |
|---|---|
i |
Edit the input folder |
Up |
Increase FPS |
Down |
Decrease FPS |
Enter |
Generate the GIF |
q |
Quit |
While editing the input folder:
| Key | Action |
|---|---|
| Text input | Type the folder path |
Backspace |
Delete the previous character |
Enter |
Save the input folder |
Esc |
Cancel editing |
The generated GIF is written to:
./output.gif
The app starts a Crossterm alternate-screen terminal, renders the interface with Ratatui, and handles keyboard input in a simple event loop.
The GIF generation flow is:
- Scan the selected input folder for supported image files.
- Sort the frame paths.
- Decode the first image to determine GIF dimensions.
- Resize every frame to those dimensions.
- Encode frames into a looping GIF using the selected FPS.
src/
app.rs App state and FPS controls
file_scanner.rs Image discovery and sorting
gif_encoder.rs GIF encoding pipeline
main.rs Terminal setup and event loop
tui.rs Ratatui layout rendering
Run a local check:
cargo check --all-targets --all-featuresFormat the code:
cargo fmtRun Clippy:
cargo clippy --all-targets --all-features -- -D warningsThis repository also includes Lefthook configuration for pre-commit checks. See CONTRIBUTING.md for setup details.
