emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Implementing image support for kitty terminal


From: Akib Azmain Turja
Subject: Re: Implementing image support for kitty terminal
Date: Thu, 08 Sep 2022 15:13:59 +0600

Jose Antonio Ortega Ruiz <jao@gnu.org> writes:

> Hi,
>
> The kitty terminal emulator (which runs under X11 and wayland) offers a
> simple protocol for displaying images, fully described at
> <https://sw.kovidgoyal.net/kitty/graphics-protocol/>.  

Many text terminals also happen to show images.  But I think Kitty is a
video terminal that also happen to show texts.

>
> In a nutshell, it accepts an escape sequence that make it enter "graphic
> mode", followed by either encoded image data or a path to an image file
> or a shared memory location to display.  Among several other niceties,
> the protocol allows drawing to rectangles specified in cell units. As a
> simple example, the sequence:
>
>    <ESC>_Gf=100,t=f,c=50,r=100;<encoded /path/to/file.png><ESC>\
>
> would make kitty draw the image in file.png rescaling it to 50 columns
> and 100 rows.  By default, the current cursor position is used, but it's
> also possible to specify pixel offsets and sizes.
>
> At first sight, it looks as if adding support for this protocol to
> emacs's tty terminal (when kitty, or the capability (it seems other
> terminals support the same protocol) is detected) shouldn't be too
> complex, and with that, perhaps, provide direct support for the
> elisp-level image- API for these terminals (so that, for instance,
> doc-view or pdf-tools or displaying images in eww buffers would work out
> of the box).  Am i wrong?

IMHO, showing images by converting to text would be a better choice.  It
would also allow to show image on Linux console.  Because the idea you
propose would probably make the Emacs C source more complex.

>
> On a personal note, if that were possible it would put emacs on a kitty
> terminal on the same league as the full graphical version for my needs,
> with the added benefit of dramatically reduced RAM footprint, faster
> display and, last but not least, a truly great alternative to pgtk in
> wayland.  So, if the implementation is feasible, i'd be willing to help
> if needed.

You can use Xwayland to run X applications on Wayland.  But Emacs has a
pgtk port, so you shouldn't need that.

Is there any X server for sixel terminals (like Kitty)?  If there is any
then you can that to run graphical Emacs in terminal.

And about the RAM footprint, every new feature usually increases RAM
footprint; so implementing this would also probably increase Emacs's
memory footprint.

>
> Thanks,
> jao

-- 
Akib Azmain Turja

Find me on Mastodon at @akib@hostux.social.

This message is signed by me with my GnuPG key.  Its fingerprint is:

    7001 8CE5 819F 17A3 BBA6  66AF E74F 0EFA 922A E7F5

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]