Typewar
Typewar

Reputation: 983

How to display graphical images in kitty-terminal using Python

I'm simply wondering how to display an image to kitty-terminal using python. Either display it from raw bytes, or from file.

Upvotes: 1

Views: 3322

Answers (1)

Typewar
Typewar

Reputation: 983

For raw images, you can do:

import subprocess
subprocess.run(["/usr/bin/kitty", "icat"], input=rawimage)

To display image from file, you can do:

import subprocess
subprocess.run(["/usr/bin/kitty", "icat", "/path/to/image.jpg"])

And for image urls, you can do:

import subprocess
subprocess.run(["/usr/bin/kitty", "icat", "https://example.org/image.jpg"])

Upvotes: 1

Related Questions