Skip to main content

imgcat

pypi license

The imgcat CLI, written in Python (and Python API, too).

It works with iTerm2 and WezTerm, and even inside tmux (for tmux, see Notes below).

Installation and Usage

pip install imgcat

Command-line interface (similar to iTerm2's imgcat):

$ imgcat local_image.png
$ imgcat a.png b.png c.png
$ cat from_stdin.gif | imgcat

# height is 10 lines
$ imgcat a.png --height 10

Python API:

>>> from imgcat import imgcat

# from the content of image (e.g. buffer in python3, str in python2)
>>> imgcat(open("./local_image.png"))

# or numpy arrays!
>>> im = skimage.data.chelsea()   # [300, 451, 3] ndarray, dtype=uint8
>>> imgcat(im, height=7)

# matplotlib, PIL.Image, etc.
>>> imgcat(Image.fromarray(im))

>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots(); ax.plot([1, 2, 3, 4, 5])
>>> imgcat(fig)

Matplotlib Backend: module://imgcat

MPLBACKEND="module://imgcat" python draw_matplotlib.py
>>> import matplotlib
>>> matplotlib.use("module://imgcat")

>>> import matplotlib.pyplot as plt
>>> fig, ax = plt.subplots()
>>> ax.text(0.5, 0.5, "Hello World!");
>>> fig.show()
# an image shall be displayed on your terminal!

IPython magic (works both in terminal and notebook)

%load_ext imgcat
%imgcat skimage.data.chelsea()

Notes

License

MIT License

Metadata

Release files for imgcat 0.6.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for imgcat 0.6.0
File Size Uploaded Provenance Actions
imgcat-0.6.0.tar.gz 12.7 kB Without provenance Details for imgcat-0.6.0.tar.gz

Release files / imgcat-0.6.0.tar.gz

Download URL imgcat-0.6.0.tar.gz
Size 12.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b3547b68adb3f1f9b611390e804c94ebd464a215858543cbf97df86fbcd7935c
BLAKE2b-256 checksum
How to use checksums
9cfac09733cb5f8a793d2429d06c510a9eaa605fc14381de6701c2df6be69502
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.9.20

Security for imgcat 0.6.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page