📜 ⬆️ ⬇️

Terminal with pictures on python: proof of concept

Since TermKit was not finished yet, it would be nice to watch at least pictures in the terminal (all the more so as they say here and here ). Yes, and it is useful for me when working with web projects. I tried to write a proof-of-concept-prototype. Under the cut screenshots, a small description of the work and links to the code.

Screenshots

Let's start with what it looks like:


The essence is as follows. Running the terminal, typing in it
cat your_image.png | show
or
show your_image.jpg
You can see the picture right in the terminal window.

Features of the implementation

[Edit] Here it was about the output of the picture, but I simplified the method that I used, and the need for the text that was there was no longer necessary. Sorry. In short, everything is done via widget.window.draw_pixbuf. [/ Edit]

Everything is more complicated with how to organize data exchange between processes. Here you can’t reinvent the wheel, named-pipes and signals are used in proof-of-concept (to signal that the picture has gone). Since there is little code, and other technologies are not used ... then we can stop at that.
')
Code

Find it all here .

findings


Probably the main thing is that the idea of ​​displaying graphics in the console is implemented not only through node.js and mime-types, as was done in TermKit, but also by good old means * nix. The rest of the beauty, of course, is easier to get by means of webkit ... and I would like to wait for it.

PS

Publish to the hub, where it was originally about TermKit.

Source: https://habr.com/ru/post/159341/


All Articles