简体   繁体   中英

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.

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"])

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM