PIC 📷
PIC (Preview Image in CLI ) is a lightweight Rust tool to preview images in your terminal!
With support for various image protocols (Kitty, Sixel, iTerm) it works in several terminals, and can still use Unicode blocks in case your terminal isn't supported.
PIC also provides a library for you to use in your own tools!
Features
- Choose your favourite protocols
- Kitty graphics with multiple actions available (
load/clear) - Sixel which works in a lot of terminals
- iTerm which displays GIFs incredibly well
- Unicode blocks with truecolor/ansi256 support otherwise
- Kitty graphics with multiple actions available (
- Customization
--xand--yoptions to choose where to display your image--colsand--rowsoptions to choose the size of your image (always tries preserving ratio)--upscaleoption to preview image at full wanted size if needed--staticand--loopoptions to interact with GIFs--protocoloption to choose a protocol--load--displayand--clearoptions to interact with Kitty protocol
Installation
From source (Recommended)
Prerequisites
Command line instructions
# Clone the repository
# Build and install
# Use freely
From Cargo
Prerequisites
Command line instructions
# Build and install
# Use freely again
As a library
Prerequisites
Command line instructions
# Add the dependency in your project directory
Examples
Blocks & Top quality previewing

Wide choice of options

Really nice GIFs in iTerm

And also nice in Blocks

Command line usage
Preview Image in CLI.
Usage: pic [OPTIONS] <PATH>
Arguments:
<PATH> Image to preview
Options:
-x, --x <X> x position (0 is left)
-y, --y <Y> y position (0 is top)
-c, --cols <COLS> Number of cols to fit the preview in
-r, --rows <ROWS> Number of rows to fit the preview in
-u, --upscale Upscale image if needed
-s, --static Only show first frame of GIFs
-l, --loop Loop GIFs infinitely
-p, --protocol <PROTOCOL> Previewing protocol to use [possible values: kitty, sixel, iterm, blocks]
--load <ID> Load image with the given id (kitty only)
--display <ID> Display image with the given id (kitty only)
--clear <ID> Clear image with the given id (0 for all) (kitty only)
-h, --help Print help
-V, --version Print version
Library usage
use pic
Notes
Sixelprotocol may require libsixel to be installediTermprotocol always loop GIFs, except if--staticis specified
Progress
Help would be greatly appreciated
- Documentation
- Write a greater README
- Make releases/packages (publish on crates.io)
- Protocols support
- Preview GIFs with Kitty protocol
- Preview GIFs with Unicode blocks
- Work on handling transparency/GIFs with Sixel protocol (GIFs work but don't render well)
- Improve protocol support checking (need to test in various terminal)
- Miscellaneous
- Implement caching somehow
- Show cooler error messages
- Write tests (I guess I need to do that...)