IMGCAT(1)
π imgcat(1) β cat, but for images π
okay so picture this: you're in the meow corner of the manual, and you just want to see a picture in your terminal. bestie, this is THE tool. β¨
πΈ SYNOPSIS πΈ
imgcat [options] image
imgcat [options] < image
π¦ DESCRIPTION π¦
imgcat prints an image to your terminal screen. that's it. that's the whole vibe. π
the image can either be handed over as a command line argument, or piped in through stdin. both are valid, both are iconic.
by default, the image is printed at the full width and color depth detected for your terminal. wanna override? sure, queen:
- use
-wto adjust the maximum width - use
-Rto prevent resizing entirely β even if the image is way too big to fit in the terminal π - use
-dto explicitly set the color depth - use
-rto adjust the height (the "r" stands for "number of rows", iykyk)
the image gets scaled without affecting the aspect ratio, unless you pass -P. periodt.
π half-height mode, aka the glow-up
setting -H enables the use of half-height block drawing characters (as opposed to the "full height" spaces used in the default mode). this effectively doubles the vertical resolution of the terminal, so the image on your screen appears less "squished" and has a greater pixel resolution. main character energy, honestly. π₯
β οΈ heads up bestie: this effect works best on terminals that output using a bitmapped font and have a line height of exactly 100% (example: https://git.io/vhW5F).
using anti-aliased fonts may distort the blocks, and using a taller line height will make the half-height block cover less than half of the block, which distorts the image even more (example: https://git.io/vhW5d). your millage may vary. π
π when output isn't a terminal
if the output is not a terminal (that is, output is redirected to a file, or piped into another program), then the image is not resized and the color depth is set to 8 colors. overriding both width, height, and color depth still work though. slay. β¨
make sure your TERM environment variable is set to a terminfo with the full capabilities of your terminal! see Troubleshooting if you're having a problem with this. π«Ά
β¨ OPTIONS β¨
-dMODE,--depth=MODE β explicitly set the output color depth to one ofansi,8(alias ofansi),256,24bit,true(alias of24bit) oriterm. if not provided, the output color depth will be inferred withtput colors.-h,--helpβ show common options and quit. cute and quick. π-H,--half-heightβ prints half-height blocks to double the vertical resolution and make for a less squished image. works best when each character cell is exactly twice as tall as it is wide, and when your terminal is using a bitmapped font.-rROWS,--height=ROWS β resizes the image to ROWS characters high. does nothing if--no-resizeis provided. maintains the original image's aspect ratio if--widthis NOT provided.-P,--no-preserve-aspect-ratioβ allows for arbitrary image resizing when specifying both--widthand--height. by default, if both--widthand--heightare provided, the image's aspect ratio is preserved (it does not get stretched in any direction), and--widthand--heightspecify the maximum amount of characters the image will be resized to. if you provide--no-preserve-aspect-ratio, then--widthand--heightare exact dimensions, and the image might get squished accordingly. π-R,--no-resizeβ does not resize the image to fit the terminal's width. overrides both--widthand--height.-v,--versionβ show version and quit.-wCOLS,--width=COLS β shrink the image to COLS characters wide. does nothing if--no-resizeis provided, or if the image is already as small as the provided width. maintains the original image's aspect ratio if--heightis NOT provided.--8,--ansiβ set the output colour depth to 8. same as--depth=8. (yes, "colour" with a u, she's fancy π )--256β set the output colour depth to 256. same as--depth=256.--24bit,--trueβ set the output colour depth to 24 bit or "true" color. same as--depth=24bit.--iterm2β set the output to iTerm inline image mode. same as--depth=iterm2.
π iTerm2 3.0
imgcat supports iTerm2's full-color inline images (use -d iterm to explicitly enable this). however β and this is the plot twist β iTerm2 is bundled with a script that is also called imgcat! π
to use this program in preference to the script bundled with iTerm2, edit your shell's configuration file such that, after the line that sources iTerm2's shell integration and utilities, you unalias its built-in script:
unalias imgcat
there. fixed. you're welcome. π«Ά
π§ Troubleshooting
first, test how many colors your terminal can output:
$ tput colors
256
if this is not what you expect, you might want to change your TERM environment variable. for example, iTerm2 users will probably want the following:
$ export TERM=xterm-256color
however, it's better that your terminal emulator reports itself with the proper value for TERM. for iTerm2, again, look under the current profile settings > Terminal > Terminal Emulation > and change "Report Terminal Type". β
π BUGS
see GitHub Issues: https://github.com/eddieantonio/imgcat/issues
π AUTHOR
imgcat was written by Eddie Antonio Santos https://eddieantonio.ca/ and contributors.
okay bestie, that's the whole page π this is the imgcat User Manual, dated December 18, 2023 β go forth and put pictures in your terminal, no cap. π¦πβ¨
π¦ where this page comes from
- nixos 26.05: imgcat 2.6.0
- nixpkgs unstable: imgcat 2.6.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms