← 返回命令列表

Linux command

chafa 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Display image in terminal

chafa [image.png]

Specify output size

chafa -s [80x40] [image.jpg]

Use sixel graphics

chafa --format sixels [image.png]

Use kitty graphics protocol

chafa --format kitty [image.gif]

Limit colors

chafa --colors [256] [image.png]

Display animated GIF

chafa --animate [animation.gif]

ASCII only output

chafa --symbols ascii [image.jpg]

说明

chafa converts images to character art for display directly in the terminal. It uses Unicode block characters, braille patterns, and ASCII art to approximate images at the resolution of the terminal grid. For terminals with advanced graphics support, chafa can output using the Sixel, Kitty, or iTerm2 graphics protocols, producing much higher fidelity results. It handles a wide range of image formats including JPEG, PNG, GIF (with animation), AVIF, SVG, WebP, TIFF, and JPEG XL. Output can be tuned by adjusting size, color depth, symbol sets, and animation speed. chafa automatically detects terminal capabilities and selects the best available output mode.

参数

-s, --size _WxH_
Output size in characters
-f, --format _format_
Output format: symbols, sixels, kitty, iterm
-c, --colors _n_
Color mode: none, 2, 8, 16, 256, full
--symbols _set_
Symbol set: all, ascii, block, braille
--fg _color_
Foreground color
--bg _color_
Background color
--animate
Enable animation for GIFs
--duration _secs_
Animation duration
--speed _factor_
Animation speed multiplier
-w, --watch
Watch file for changes
--font-ratio _ratio_
Font width/height ratio

FAQ

What is the chafa command used for?

chafa converts images to character art for display directly in the terminal. It uses Unicode block characters, braille patterns, and ASCII art to approximate images at the resolution of the terminal grid. For terminals with advanced graphics support, chafa can output using the Sixel, Kitty, or iTerm2 graphics protocols, producing much higher fidelity results. It handles a wide range of image formats including JPEG, PNG, GIF (with animation), AVIF, SVG, WebP, TIFF, and JPEG XL. Output can be tuned by adjusting size, color depth, symbol sets, and animation speed. chafa automatically detects terminal capabilities and selects the best available output mode.

How do I run a basic chafa example?

Run `chafa [image.png]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -s, --size _WxH_ do in chafa?

Output size in characters