imgcat provides a Python API and CLI tool to display images directly in supporting terminals (like iTerm2 or Kitty) using their graphics protocols. The current version is 0.6.0, released in November 2024, with major updates occurring periodically to add features and improve compatibility.
pip install imgcatVerified import paths — ran on the pinned version, not inferred.
This example shows how to import and use the `imgcat` function to display a randomly generated NumPy array directly in a compatible terminal. Ensure your terminal (e.g., iTerm2, Kitty, WezTerm) supports iTerm2/Kitty graphics protocols.
Upgrade to Python 3.6 or newer. Previous versions (<=0.5.0) supported Python 2.
Use a compatible terminal emulator such as iTerm2, Kitty, or WezTerm. Check your terminal's documentation for image display support.
Ensure your NumPy array data is scaled correctly (e.g., `np.uint8` with values 0-255, or `float` with values 0-1). For example, `(np.random.rand(H, W, 3) * 255).astype(np.uint8)`.
Upgrade to `imgcat` version 0.6.0 or newer to benefit from fixes for matplotlib integration problems.
Run `pip install imgcat` to install the library.
Switch to a compatible terminal like iTerm2, Kitty, or WezTerm, or ensure your terminal is configured to enable image display.
Convert your data to a supported type, e.g., a NumPy array, a PIL Image object, or a path to an image file. Ensure you have the necessary optional dependencies installed for tensor types.
In an IPython/Jupyter environment, use the magic command `%load_ext imgcat` to enable the `%imgcat` magic.