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 22:03:41 +0200

On Thu 08 Sep 2022 at 22:30, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Tomas Hlavaty <tom@logand.com>
>> Cc: emacs-devel@gnu.org
>> Date: Thu, 08 Sep 2022 21:15:37 +0200
>> 
>> The problem is, that that capability is not available in tty emacs:
>
> Yes, it _is_ available.  We just suppress it.

Interesting, is it possible to somehow "un-suppress" it?

>>    (image-size (create-image "/tmp/a.jpg"))
>>    => (error "Window system frame should be used")
>
> This is us deliberately failing image-size early on, because we don't
> want complications down the road, and because we know images cannot be
> displayed on TTY frames.

I am asking emacs to tell me the size of the image.
I am not asking emacs to display it.

>> Would it be possible to fix that?
>
> I don't see why it would be hard.  E.g., this works just fine in a -nw
> session:
>
>   (create-image "/tmp/a.jpg")

Why does create-image work and image-size does not?

Why is this not "us deliberately failing create-image early on, because
we don't want complications down the road, and because we know images
cannot be displayed on TTY frames."?

Also this returns:

   (image :type jpeg :file "/tmp/a.jpg" :scale 1 :transform-smoothing t)

which does not tell me image width and height that I'd like to know.

>> > 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?)
>
> We don't need 'file',

Yes, that was my point.

> Emacs already knows how to compute the size of an image.

So how do I get the size of an image?

My tty emacs does not know that, I get this error:

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

Maybe tty emacs already knows how to compute the size of an image, but I
have not figured a way of asking my tty emacs to share that information
with me.  Is there a way?



reply via email to

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