#color #fork #image #width-height #github #ansi-colors #file

bin+lib termpic

Fork of https://github.com/hopey-dishwasher/termpix

3 releases (stable)

new 1.0.1 Dec 27, 2024
0.1.0 Dec 27, 2024

#15 in #width-height

Apache-2.0

16KB
421 lines

termpic - FORK of termpix

Draw images in an ANSI terminal! Requires that your terminal can show ANSI colours, and uses a font that can show the 'bottom half block' character (▄).

Usage

cargo install termpic
termpic <file> [--width <width>] [--height <height>] [--max-width <max-width>] [--max-height <max-height>] [--true-color|--true-colour] [--output <file>]

buzz

file can be any image file readable by the rust 'image' library. I've seen it fail with some unusual jpeg files ("Marker SOF2 is not supported.")

By default, it will fill as much of the terminal as possible, while keping the aspect ratio of the input image. Use --width or --height to override this, specifying the number of terminal rows or columns to fit to (Or both to specify an absolute size). Alternatively, use --max-width and/or --max-height to fit to the terminal up to a maximum.

buzz smaller

If your terminal supports it, you can use the full 24-bit colour palette with the --true-colour flag: lena looks good

In low-colour mode, high-contrast, colourful images tend to work better than flatter images. Skin tones and shades of brown are particularly poorly represented in the ANSI colour pallette. lena looks bad

License

Apache 2.0 license

Dependencies

~5–14MB
~194K SLoC