From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Akib Azmain Turja Newsgroups: gmane.emacs.devel Subject: Re: Implementing image support for kitty terminal Date: Thu, 08 Sep 2022 17:13:18 +0600 Message-ID: <871qsmazld.fsf@disroot.org> References: <87v8pz18wf.fsf@mail.jao.io> <83o7vrgimc.fsf@gnu.org> <87wnafdnee.fsf@logand.com> <87a67bymys.fsf@mail.jao.io> Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7747"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Tomas Hlavaty , Eli Zaretskii , emacs-devel@gnu.org To: Jose A Ortega Ruiz Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 08 14:28:59 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oWGeP-0001gx-4y for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Sep 2022 14:28:57 +0200 Original-Received: from localhost ([::1]:53534 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oWGeN-0006JJ-OB for ged-emacs-devel@m.gmane-mx.org; Thu, 08 Sep 2022 08:28:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56198) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWGMT-0003nO-HD for emacs-devel@gnu.org; Thu, 08 Sep 2022 08:10:28 -0400 Original-Received: from knopi.disroot.org ([178.21.23.139]:60378) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oWGMQ-0004Dq-TT; Thu, 08 Sep 2022 08:10:25 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id BD04049FF9; Thu, 8 Sep 2022 14:10:20 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Original-Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 6ovwWIy8kZuV; Thu, 8 Sep 2022 14:10:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1662638913; bh=epJZcLa3cF4Ku20ZcxJ49SSYYmoTCO5Sv8J+DX7sAcE=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=enNU6iV2VTIGSpACpzpN7Tez69g+wt+Ms+IpxGDeozxeZjuULgCT3SnpRwuTUQcBk 3Wq51bZKL3Efk0zrGPO2FiqRuor53KdQaamJNKTZUqSAQ0CM0DBA5XMVGVaU7IeWpD /JBn4p8raVxn0y11venC8PchcMetKgMnofqB2D8EV4iUWHu4MiGkeETNnxboQt7Nmn Pw4pFn/iwxTJw3pint5PC90A7yLSVsjcbCyVh9qACKi5UrbJ+oyCouEuY3Eio8KT04 QIn07Go7R33JyF/PB3CIP5qZkJcUt5ImgJTZIBxR2ve0/Ae1bapWU0paZo/jVVlS0A uG8pofkvqWeMA== In-Reply-To: <87a67bymys.fsf@mail.jao.io> (Jose A. Ortega Ruiz's message of "Wed, 07 Sep 2022 20:59:55 +0100") Received-SPF: pass client-ip=178.21.23.139; envelope-from=akib@disroot.org; helo=knopi.disroot.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:294938 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Jose A Ortega Ruiz writes: > On Wed, Sep 07 2022, Tomas Hlavaty wrote: > >> On Wed 07 Sep 2022 at 21:11, Eli Zaretskii wrote: >>> In particular, the current model of image display >>> in the Emacs display engine is that an image is basically considered a >>> single very large character, from the screen layout POV. >> >> Are you talking about GUI emacs? >> Is that not different in tty emacs? >> I thought that the tty emacs has no concept of image (so far?). >> >>> I guess >>> that's not what you have in mind for the above, so IMO it's important >>> to come up with an alternative model that would somehow fit with the >>> current display code with only minor changes, if we want this not to >>> be too complex. >> >> For example, the tty based w3m web browser optionally supports images. >> It reserves space w*h chars on the tty and then uses external program >> to draw the image in the right place. >> >> I guess tty emacs would also need to reserve a w*h chars rectangle on >> the tty and then send the right escape code to fill that gap with the >> image. >> >> 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#l= 286 >> 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? 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. > >> Second, tty emacs would need to somehow reserve rectangle for the image. >> This might be lots of work I guess. > > i was hoping this wouldn't be the case... at least when running inside > terminal emulators, emacs nox seems pretty dexterous lying out windows > and filly them with content, and i reckoned it must have a pretty good > idea of their sizes. but maybe i'm too optimistic :) > >> Third, there would have to be a piece of code which actually draws the >> image. In case of kitty terminal, the image path and coordinates would >> be sent to the tty using the kitty terminal protocol. > > (as an aside, this would also work for other terminals like konsole or > wayst, which support the protocol). > > cheers, > jao What? You need to send the path of the image? How would this work for a SSH session? =2D-=20 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 --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEyVTKmrtL6kNBe3FRVTX89U2IYWsFAmMZzk4ACgkQVTX89U2I YWt0eg//ageLY3p6uEIyjcBgkek/SQDjaA2LIm0wqMLvQjzAs8bgsTQKe3jgRSGX a5S31lZ2+Wu6zCUxsxAGZJxx76jpC5W6niMVjquRwtJP7+WNJtay8zoGGdzNs8AI aL56sgezKHyg424hTfg+jxDoe6qb1R8RjQMxOtEgSDOxqv0gLEPdZJL3I1tg55hP yAajWvOOPWb2jDIMqczsYEKwq5oC9gVX4za4ThB+ex7ORlCKbG8uPYAv8rOPWY0R ekUddPaXBe6BtO6YEwBYyCHwGE7vth6qJoTWJ79V9f+bk6UkxhdCHYNtaKQMsymo fNw8hUZRzXey7xP/EKQinev063lqs/SAcN49YwXYyS0uZPLy8/aNS+9HLE4ur3i9 hADEeyHzhCzOVdDxpmPzQlEwKX4919NasY5919xvN7bk5tlq6eAGGkYRSz2+bpE1 Rst2HsMs/evO8LhEvHo00BJPiZMpX02LzXc8ctA8I6HIpVewkZ29cLylhYhB5uRL zPwbTBC1efjTOvNVFNCMVcs/NfIy7eh8keaDOPGQAhCOMGZkIu+6g2GJc4poGcL8 fEt4Ofg79ZKFQ0DfitbZlfWzgjvmhgTOzimpO5s3NsQnc/dUvOgJ1NH0y5mUeLzh AD8rEkdNmIQODemCy727NvPs1C5WJruWcxGiDVjM9BS4j+vrZLo= =DqWP -----END PGP SIGNATURE----- --=-=-=--