imgcat Python Library

0.6.0 · active · verified Thu Apr 16

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.

Common errors

Warnings

Install

Imports

Quickstart

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.

from imgcat import imgcat
import numpy as np

# Display a random numpy array as an image
# (100x100 pixel RGB image with values 0-255)
imgcat(np.random.randint(0, 256, size=(100, 100, 3), dtype=np.uint8))

# In an IPython/Jupyter environment, you can also use:
# %load_ext imgcat
# %imgcat np.random.rand(100, 100, 3)

view raw JSON →