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: Tomas Hlavaty
Subject: Re: Implementing image support for kitty terminal
Date: Thu, 08 Sep 2022 21:15:37 +0200

On Wed 07 Sep 2022 at 20:59, Jose A Ortega Ruiz <jao@gnu.org> wrote:
> On Wed, Sep 07 2022, Tomas Hlavaty wrote:
>> First, tty emacs would need to understand images instead of throwing
>> error.  At least their dimensions.  Maybe using some library or even in
>> elisp, for example like this
>> https://logand.com/sw/emacs-framebuffer/file/emacs-framebuffer.el.html#l286
>> I have not figured out, how to actually plug it into upstream emacs, as
>> this seems to require a lot of changes to C code.
>
> fwiw, in the kitty case, image libraries are going to be almost for sure
> available, it being an x11/wayland application.  so an emacs compiled
> with image support (but not necessarily linking against any x libs)
> doesn't seem like a strong requirement.  in that scenario, determining
> the size of an image wouldn't needed a lot of C code, would it?

Note the difference between
"a lot of changes to C code" vs "a lot of C code".

I already linked an elisp function which does that.
It would be easy to write it in C.
Emacs already has the capability anyway.
The problem is, that that capability is not available in tty emacs:

   (image-size (create-image "/tmp/a.jpg"))
   => (error "Window system frame should be used")

Would it be possible to fix that?

> and, if
> those libraries are not available, a call to "file foo.png" is (at least
> in my system) telling me the size of foo.png... kind of hacky, of
> course, but as a first step maybe good enough.

This is the easy part.  Then you need to change the existing emacs C
code to actually call that.

(btw isn't the file program potential security issue?)



reply via email to

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