CHAFA(1)
π CHAFA π
okay bestie, welcome to the chafa manual, section 1 of the User Commands β and yes the manual name is CHAFA(1), we're not being subtle about it π this is the "Character art facsimile generator" and she is that girl. β¨
πΈ NAME πΈ
chafa β Character art facsimile generator π¦
β¨ SYNOPSIS β¨
chafa [OPTION...] [IMAGE...]
That's the whole thing. Options first, then your images. Clean, simple, slay. π
π DESCRIPTION π
okay so picture this: chafa is a command-line utility that converts image data β and literally yes, that includes animated GIFs, we love her π β into graphics formats or ANSI/Unicode character art suitable for display in a terminal.
her feature support is broad. like, broad broad. she works on devices ranging from historical teleprinters all the way to modern terminal emulators and everything in between. the range?? the way she just... does it all?? no cap, she's the moment. π
You can specify one or more input files, no problem, BUT β and this is the part you need to write down bestie βοΈ β the default behavior is slightly different with multiple files. for instance, animations will not loop forever when there is more than one input file. so if your GIF is behaving differently than you expected when you stacked files, that's why. not a bug, it's a feature, periodt.
π GENERAL OPTIONS π
--filespath β Read a list of paths to process from path, or-for stdin. The paths must be separated by newlines. π
Can be specified multiple times. Any additional paths on the command line will be processed last.
--files0path β Same idea as--files, but read from path, or-for stdin, with the paths separated by NUL bytes instead. This is more robust if your file system allows newlines in filenames (as POSIX does, and she's just being thorough π ). Super useful in conjunction with other tools that support it, e.g.:
find . -type f -print0 | chafa --files0 -
Can be specified multiple times. Any additional paths on the command line will be processed last.
-h,--helpβ Show a brief help text. short, sweet, helpful. π«Ά--probearg β Probe the terminal's capabilities and wait for response[auto, on, off]. A positive real number denotes the maximum time to wait for a response, in seconds. Defaults to5.0. β³--probe-modemode β How to probe the terminal[any, ctty, stdio]."Any"is the default and will probe by any means available."Ctty"will probe the controlling tty, usually/dev/tty, which is useful when chafa is part of a pipeline β but heads up, this may block if done in the background π."Stdio"will only consider standard input/output. pick your fighter. π₯--versionβ Show version, feature and copyright information. the receipts, the credentials, the whole rΓ©sumΓ©. π
π OUTPUT ENCODING π
-f,--formatformat β Set output format; one of[iterm, kitty, sixels, symbols]. The default isiterm,kittyorsixelsif the connected terminal supports one of these, falling back tosymbols(that's your"ANSI art") otherwise. β¨-Onum,--optimizenum β Compress the output by using control sequences intelligently[0-9].0disables,9enables every available optimization. Defaults to5, except for when used with"-c none", where it defaults to0. so like, the higher the number the more she flexes. π--relativebool β Use relative cursor positioning[on, off]. Whenon, control sequences will be used to position images relative to the cursor. Whenoff, newlines will be used to separate rows instead for e.g.'less -R'interop. Defaults tooff.--passthroughmode β Graphics protocol passthrough[auto, none, screen, tmux]. Used to show pixel graphics from within multiplexers. Defaults toauto, which will enable passthrough if the Kitty terminal is detected along with one of the supported multiplexers. Other combinations must be enabled manually; use with the-foption to select the appropriate graphics protocol. π--politebool β Polite mode[on, off]. Inhibits escape sequences that on rare occasions may confuse the terminal or other programs. Defaults tooff. she's on her best behavior only when asked, and honestly? mood. π
π¦ SIZE AND LAYOUT π¦
--alignALIGN β Align images in viewport. The following alignments are understood:left,right,top,bottom,hcenter,vcenter,center. Two orthogonal alignments can be separated by a comma, e.g."center,right". The meaning of"center"depends on context, and defaults to"hcenter"if ambiguous."center,center"will center along both axes. π
Centering vertically makes sense when used together with "--clear", or possibly as part of a scheme where the cursor is pre-positioned at the top-left corner of the view, or a subview when used with "--relative on".
-Cbool,--centerbool β Center images horizontally in the view[on, off]. Defaults tooff. This option is deprecated; use"--align center"instead. π΅ (she's old, be nice, use the new one)--clearβ Clear screen before processing each file. fresh slate every time, we love a clean start. π§Ό--exact-sizemode β Try to match the input's size exactly[auto, on, off]. Whenon, this will override other sizing options and produce output images at the exact pixel size of the inputs. Inautomode, scaling will be avoided (in exchange for padding) if the output size is equal to or slightly bigger than the input. Whenoff, padding will never be added, and the image is scaled to fit the containing cell extent. Defaults toauto. π--fit-widthβ Fit images to the view's width, potentially exceeding its height. width said yes, height said we'll see. π--font-ratiowidth/height β Target font's width/height ratio. Can be specified as a real number or a fraction. Defaults to1/2. This will only be applied in symbol mode. π€--gridcolsxrows β Lay out images in a grid of cols columns and rows rows per screenful. Either cols or rows may be omitted, e.g.--grid 4or--grid x4, in which case cell allocations will be approximately square. If"auto"is specified, dimensions will be picked automatically. β¨-gβ Alias for"--grid auto". the shortcut, the little treat. π--labelbool β Labeling[on, off]. When this is enabled, each image will be labeled with its filename. Defaults tooff. nametags but make it pixels. π·οΈ-lβ Alias for"--label on".--margin-bottomnum β When terminal size is detected, reserve at least this many rows at the bottom as a safety margin. Can be used to prevent images from scrolling out. Defaults to1. π--margin-rightnum β When terminal size is detected, reserve at least this many columns on the right-hand side as a safety margin. Defaults to0.--scalenum β Scale image, respecting terminal's maximum dimensions.1.0approximates original pixel dimensions. Specify"max"to use all available space. Defaults to1.0for pixel graphics and4.0for symbols. π-swidthxheight,--sizewidthxheight β Set maximum output image dimensions in columns and rows. By default this will be equal to the view size (see--view-size).--stretchβ Stretch image to fit output dimensions; ignore aspect. Implies--scale max. she will not be respecting the aspect ratio, she's going full send. π₯--view-sizewidthxheight β Set the view size in columns and rows. By default this will be the size of your terminal, or80x25if size detection fails. If one dimension is omitted (by providing a size of e.g.80xorx25), it will be set to a reasonable approximation of infinity. βΎοΈ
β° ANIMATION AND TIMING β°
--animatebool β Whether to allow animation[on, off]. Defaults toon. Whenoff, will show a still frame from each animation. she can move, she can freeze. range! π-d,--durationseconds β Time to show each file, in seconds. Defaults to zero for still images and for animations when multiple files are specified. If a single animation is specified, defaults to infinite, or"inf". Animations will always be played through at least once, even if duration is e.g. zero. See the"Duration"section for more. π--speedspeed β Set the speed animations will play at. This can be either a unitless multiplier (fractions are allowed), or a real number followed by"fps"to apply a specific framerate. πββοΈ--watchβ Watch a single input file, redisplaying it whenever its contents change. Will run until manually interrupted or, if--durationis set, until it expires. π she's always watching, bestie.
π COLORS AND PROCESSING π
--bg colorβ the background color of the display, bestie. Say it as a color name or a hex value. Any partially transparent parts of your input get blended against this, so it's giving backdrop realness. Color names are based on the ones X.Org ships with. Defaults to black, or β when probing is turned on β the terminal's own default background (peep--probe).-c mode,--colors modeβ tells chafa what color mode to output in. Pick one of [none, 2, 8, 16/8 16, 240, 256, full]. Okay important tea: the 240-color mode is genuinely the recommended one over 256, because the lower 16 colors are unreliable and tend to differ between terminals (they're messy fr). The 16-color mode uses aixterm extensions to produce 16 foreground and background colors. The 16/8 mode does 8 colors plus another "bright" 8 in the foreground, implemented with the "bold" escape sequence. The 2-color mode only emits the ANSI codes for reverse color and attribute reset, while "none" emits no escape sequences at all β zero, nada. π
And in sixel mode? "full" dynamically generates a 256-color palette for each image or animation frame. The other modes refer to built-in palettes. Note that "none" and "2" are interchangeable and will use the foreground/background colors you specified (go see --fg and --bg). If you leave it unspecified, chafa picks an optimal default based on the current environment. She's adaptive like that. β¨
--color-extractor extractorβ the method for pulling color out of an area; one of [average, median]. median normally produces crisper output, while average may do better on noisy images. Defaults to average.--color-space csβ the color space used for quantization; one of [rgb, din99d]. Defaults to rgb, which is faster but less accurate. Trade-offs, bestie.--dither typeβ the type of dithering to apply during quantization. One of [none, ordered, diffusion, noise]. Heads up: "Bayer" is a synonym for "ordered", and "fs" (Floyd-Steinberg) is a synonym for "diffusion". Defaults to "noise" in sixel mode, otherwise "none".--dither-grain widthxheightβ the dimensions of the grain used while dithering. You write it as width x height, where each one can be one of [1, 2, 4, 8] pixels. For the record: one character cell is, by definition, 8 pixels across in both dimensions. Defaults to 4x4 in symbol mode and 1x1 in sixel mode.--dither-intensity intensityβ how intense the dithering pattern is. It ranges from 0.0 to infinity, with 1.0 considered neutral. Lower values tend to reduce how much dithering gets done, higher values crank it up. Realistically though? Values higher than 10.0 are unlikely to produce useful results, so maybe don't. π--fg colorβ the foreground color of the display (color name or hex). Together with the background color from--bg, this is what specifies the terminal's palette in color modes 2 and none. Color names are based on the ones X.Org provides. Defaults to white, or β when probing is on β the terminal's default foreground (see--probe).--invertβ inverts the video, specifically for displaying with bright backgrounds in color modes 2 and none. It swaps--fgand--bg. Iconic behavior honestly.-p bool,--preprocess boolβ image preprocessing [on, off]. Defaults to on when you're at 16 colors or lower, and off otherwise. What it does is enhance colors and contrast before conversion, which is super useful in low-color modes. Glow-up for your pixels. β¨-t threshold,--threshold thresholdβ the threshold above which full transparency gets used [0.0 - 1.0]. Living on the edge here: setting it to 0.0 will render a blank image, while a value of 1.0 will replace any transparency with the background color (which you can configure with--bg). Choose wisely. π«Ά
π RESOURCE ALLOCATION π
--threads numβ the maximum number of CPU threads to use. If you leave it unspecified or set it negative, it'll just equal however many CPU cores you have available. Free real estate.-w num,--work numβ how hard chafa should work, in terms of CPU and memory, on a scale of [1-9]. 1 is the cheapest, 9 is the most accurate. Defaults to 5. The classic "how much do you care" dial. π
π¦ EXTRA OPTIONS FOR SYMBOL ENCODING π¦
--fg-onlyβ leaves the background color untouched. This produces character-cell output using foreground colors only, and avoids resetting or inverting the colors. Clean and minimal, we love her.--fill symbolsβ specify the character symbols to use for fill/gradients. Defaults to none. Usage is similar to--symbolsβ go look below for the full rundown.--glyph-file fileβ loads glyph info from file, which can be any font file FreeType supports (TTF, PCF, etc). The glyph outlines here will replace any existing outlines, builtins included. This is useful in symbol mode for custom font support, or for boosting quality with one specific font. Real talk though: it only makes sense if your output terminal is actually using a matching font. Can be specified multiple times. πΈ--symbols symbolsβ specify which character symbols to employ in the final output. Full usage plus the whole list of symbol classes is right below. π
π EXIT STATUS π
chafa returns 0 on success, 1 on partial failure, or 2 on complete failure β and yes, that includes when you invoke it with no arguments at all. Not me getting hit with a 2 on an empty command. π
- 0 β Success
- 1 β Some files failed to display
- 2 β All files failed to display
π€ SYMBOLS π€
The accepted classes for --symbols and --fill are [all, none, space, solid, stipple, block, border, diagonal, dot, quad, half, hhalf, vhalf, inverted, braille, technical, geometric, ascii, legacy, sextant, wedge, wide, narrow]. Some symbols belong to multiple classes β for example, diagonals are also borders. Crossover icons, honestly.
You can add specific characters by writing the letter "u" followed by a hexadecimal code point, like "ue080". Or you can add a whole range of code points by separating the first and last index with "..", like "u100..u200". Periodt.
Symbol sets can also be specified as a string of UTF-8 characters inside square brackets, like [abcd]. And if you need to include a closing bracket in the set, just escape it with a backslash.
You can give a list of classes separated by commas, or prefix them with + and - to add or remove symbols relative to the existing set. Heads up: the ordering is significant. Ordering always matters. π
The default symbol set is block+border+space-wide-inverted for all modes except "none", which uses block+border+space-wide (including inverse symbols).
β³ DURATION β³
To accommodate both interactive use and batch processing, an animation's duration gets determined by a few simple rules:
- If one or more
--durationarguments are present, the final instance is respected and applied to every file. - Otherwise, if there's a controlling terminal attached (which signals there's an interactive session), and only a single file argument is provided, and that file is an animation, it will have infinite duration. She just keeps going, bestie.
- Otherwise (no controlling terminal, multiple files, or the file is a still image), duration will be zero β which causes animations to play once and then stop.
β¨ EXAMPLES β¨
chafa in.gif
chafa in.gif
Shows a potentially animated GIF image right there in your terminal. If it is an animation, it'll run until the user generates an interrupt (typically ctrl-c). All parameters get autodetected based on the current environment. Effortless. π
chafa -c full -s 200 in.gif
chafa -c full -s 200 in.gif
Same vibe as above, but it forces truecolor output that's 200 characters wide, and calculates the height while preserving the aspect ratio of the original image. Math ate.
chafa -c 16 --color-space din99d --symbols -dot in.jpg
chafa -c 16 --color-space din99d --symbols -dot in.jpg
Generates 16-color output with perceptual color picking, and avoids using dot symbols. No dots allowed. π«
chafa -c none --symbols block+border-solid in.png
chafa -c none --symbols block+border-solid in.png
Generates uncolored output using block and border symbols, but avoids the solid block symbol.
π FURTHER READING π
See the Chafa homepage[1] for more info. Go read, you'll love it.
π AUTHOR π
Written by Hans Petter Jansson[2] <hpj@hpjansson.org>.
π NOTES π
- Chafa homepage β https://hpjansson.org/chafa/
- Hans Petter Jansson β https://hpjansson.org/
Okay that's the whole page bestie, we made it to the end π β this was chafa's entry in section CHAFA(1), and big thanks to Hans Petter Jansson for writing it and giving it a home at hpjansson.org and hpjansson.org/chafa/. Go forth and render all the things. ππ¦β¨
π¦ where this page comes from
- fedora 43: chafa 1.18.3-1.fc43 Β· LGPL-3.0-or-later
- fedora 44: chafa 1.18.3-1.fc44 Β· LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms