Skip to content

AkashJana18/glyphix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Glyphix

Glyphix is a terminal-based GIF renderer written in Rust that converts animated GIFs into ASCII and plays them directly in the terminal.

It implements a full decoding pipeline including frame compositing, transparency handling, and disposal methods to closely match actual GIF playback behavior.

Overview

Glyphix is designed as a low-level exploration of image processing, terminal rendering, and systems programming in Rust.

Instead of treating GIFs as static images, Glyphix correctly reconstructs each frame by:

  • Decoding raw GIF frames
  • Applying frame offsets within a logical canvas
  • Respecting alpha transparency
  • Handling disposal methods (Keep, Background, partial support for Previous)
  • Converting composited frames into ASCII representation
  • Rendering animated output in the terminal with proper timing

Features

  • GIF metadata inspection
  • Frame-level decoding and compositing
  • ASCII conversion based on luminance
  • Terminal animation playback
  • CLI-based workflow

Installation

git clone https://github.com/<your-username>/glyphix.git
cd glyphix
cargo build --release

Binary will be available at:

target/release/glyphix

Usage:

  1. Inspect GIF metadata
glyphix inspect <path-to-gif>

Outputs:

  • Canvas dimensions
  • Frame count
  • Repeat behavior
  • Total duration
  1. Render first frame : Displays the first frame as ASCII.
glyphix frame <path-to-gif>
  1. Play animation: Renders the full animation in the terminal once.
glyphix play <path-to-gif>

More commands coming soon...


Architecture & Processing Pipeline

image image

Key Concepts

1. Frame Compositing

  • GIF frames are not always full images. Many are partial updates positioned using offsets.
  • Glyphix reconstructs the final image by drawing each frame onto a persistent canvas.

2. Transparency (Alpha Channel) : Each pixel contains an alpha value:

  • 0 → fully transparent (ignored)
  • 255 → fully visible
  • Transparent pixels do not overwrite existing canvas data.

3. Disposal Methods : Each frame specifies how the canvas should be updated after rendering:

  • Keep → retain frame
  • Background → clear frame region
  • Previous → partially supported (coming soon...)

4. ASCII Mapping

  • Pixel brightness is computed using Standard Luminance Formula: 0.299R + 0.587G + 0.114B
  • Mapped to a character set: @%#*+=-:.

Crates Used

  • clap — CLI argument parsing
  • gif — GIF decoding and frame handling
  • image — image processing utilities
  • crossterm — for terminal rendering and control
  • anyhow — ergonomic error handling

Roadmap

  • Full disposal method support
  • ANSI color output
  • Performance optimizations for large GIFs
  • Configurable ASCII character sets
  • Resize and scaling options

Limitations

  • Partial support for DisposalMethod::Previous
  • No color rendering (grayscale ASCII only)
  • Performance not optimized for large GIFs

Integrations

  • Export ASCII animation frames (JSON/Lua) for external integrations
  • Experimental Neovim dashboard integration for animated ASCII rendering

Future Explorations

  • Terminal-based dashboards and UI integrations
  • ASCII preview generation for developer tooling and demos
  • Lightweight animation rendering for remote/SSH environments

About

GIF to ASCII terminal renderer cli in Rust. Tutorial video in the link below:

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages