Display images in terminals using Unicode mosaics and ANSI colors
Project description
catpic
Turn images into terminal eye candy using Unicode mosaics and ANSI colors.
The twist: Save as MEOW format and display with cat. Yes, the POSIX command. No special viewer needed.
catpic photo.jpg -o photo.meow
cat photo.meow # 🐱 Just works
What are Glyxels?
Glyxels (glyph + pixels) are what happens when you treat each terminal character as a tiny canvas. catpic uses the EnGlyph algorithm to subdivide characters into grids—for example, BASIS 2×4 means each character represents 8 glyxels (2 wide, 4 tall).
The magic:
- Slice your image into character-sized cells
- Find the two most important colors in each cell
- Pick the Unicode character that matches the glyxel pattern
- Paint it with ANSI true-color
Result? A standard 80×24 terminal becomes a 160×96 glyxel display. Not bad for text.
Features
cat-compatible format: MEOW files display with standard POSIXcat- Multiple BASIS levels: Trade speed for quality (1×2 to 2×4)
- Smooth animations: GIF playback with no flicker
- Primitives API: Build your own TUI graphics with composable functions
- Environment aware:
CATPIC_BASISsets your preferred quality - Multi-language: Python (stable), C (in development), Rust/Go (planned)
Installation & Usage
See IMPLEMENTATION.md for installation instructions and API documentation for your language.
Each implementation provides the same core functionality with language-appropriate APIs and conventions.
Environment Variables
CATPIC_BASIS - Set default BASIS level for all operations:
export CATPIC_BASIS=2,4
catpic photo.jpg # Uses BASIS 2×4
# Also accepts: 2x4, 2_4
How BASIS Works
BASIS (x, y) defines the glyxel grid per character:
- 1×2 (4 patterns): Fast, chunky. Good for large images or overviews.
- 2×2 (16 patterns): Balanced. Default for most use cases.
- 2×3 (64 patterns): Smooth gradients. Sextant blocks.
- 2×4 (256 patterns): Maximum detail. Braille patterns.
Higher BASIS = more glyxels per character = better quality, slower rendering.
MEOW Format
Mosaic Encoding Over Wire—glyxel images in plain text:
MEOW/1.0
WIDTH:80
HEIGHT:24
BASIS:2,4
DATA:
[ANSI-colored character grid with embedded glyxels]
The beauty: it's just ANSI escape codes and Unicode. Use cat, less, grep, version control—standard POSIX tools work out of the box.
Example:
# Create
catpic sunset.jpg -o sunset.meow
# Display (any of these work)
cat sunset.meow
less -R sunset.meow
head -n 30 sunset.meow # Preview
# Share
git add sunset.meow # Version control friendly
echo "sunset.meow" | xargs cat # Standard text processing
Project Structure
catpic is designed as a multi-language project with consistent behavior:
catpic/
├── python/ # Python reference implementation (stable)
├── c/ # C implementation (in development)
├── rust/ # Rust implementation (planned)
├── go/ # Go implementation (planned)
├── docs/ # Architecture and API documentation
├── spec/ # MEOW format and compliance specifications
└── benchmarks/ # Performance comparisons
All implementations:
- Support the identical MEOW format
- Pass the same compliance test suite
- Implement the EnGlyph algorithm consistently
- Support all BASIS levels
Language-specific APIs differ to match ecosystem conventions.
Documentation
- IMPLEMENTATION.md - Installation and usage for each language
- docs/primitives_api.md - Low-level API for TUI development
- spec/meow_format.md - Format specification
- spec/compliance.md - Cross-language test requirements
- CONTRIBUTING.md - Development guidelines
Contributing
Contributions welcome! See CONTRIBUTING.md for:
- Code style and testing requirements
- How to add new BASIS levels
- Cross-language implementation guidelines
- Prospective features (Sixel/Kitty graphics, streaming, etc.)
License
MIT—do whatever you want with it.
See Also
- EnGlyph - The Textual widget that inspired this
- docs/primitives_api.md - Build your own TUI graphics
Built with Claude (Anthropic) exploring terminal graphics techniques that don't suck.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file catpic-0.5.2.tar.gz.
File metadata
- Download URL: catpic-0.5.2.tar.gz
- Upload date:
- Size: 64.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99186143b5c5bef2ac0f7a6d8f870a7ccd3b3fadbfc6b6d4343b58728ab62074
|
|
| MD5 |
4d6ba10b3694d5d3cb144f50318f8c48
|
|
| BLAKE2b-256 |
f397e86673630a119faa45344fe74b832cb8fb7b7adea752797854c4f7f71346
|
File details
Details for the file catpic-0.5.2-py3-none-any.whl.
File metadata
- Download URL: catpic-0.5.2-py3-none-any.whl
- Upload date:
- Size: 37.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.5.29
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1429a38f9bfeabe2671faf362de80afa0ddf63d53b1d0257d303ef46942f54ac
|
|
| MD5 |
ad62bb7b31132d76b246cbf00528b19b
|
|
| BLAKE2b-256 |
7926fb99c3461c1298fddfdf30b99dbc4dc80cbd9dfc223ef8b039014423c39b
|