From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jose Antonio Ortega Ruiz Newsgroups: gmane.emacs.devel Subject: Implementing image support for kitty terminal Date: Wed, 07 Sep 2022 16:50:08 +0100 Message-ID: <87v8pz18wf.fsf@mail.jao.io> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37008"; mail-complaints-to="usenet@ciao.gmane.io" To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 07 17:52:45 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 1oVxM5-0009Ua-C0 for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Sep 2022 17:52:45 +0200 Original-Received: from localhost ([::1]:59564 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVxM4-0006NY-30 for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Sep 2022 11:52:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:49400) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVxJu-0004mh-OD for emacs-devel@gnu.org; Wed, 07 Sep 2022 11:50:39 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:35652) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVxJt-0003tx-Dm; Wed, 07 Sep 2022 11:50:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=d1+BuMvFTY350GyqjKBjH0YIhdTVvir3kFKcOdSvliA=; b=OdBLYg20XKfBWo W+aJZsUe+enpKq69wnh2T14lXIXGuubXSo5L/vJexZ7ExZL4Ih9Pz5vXafbOrKDOljy4NuQ2RgBBM srPEuwi/0EHVimhc4nOmmhosQ7Saeup9bO66w536uGYQ/zflDL3dtHkDTZtGdrTnjs8+m+JHdlRmy ir/0uVFx9yynfE38i6laTlvjfgrXIyfAMMbmUDc+XCMZ7kk5yjo4oLTkOHyVfpdpiT4yoKDLY16Xu m6P0T/yDM25N88fDDBHqFddpJo2FfDFF2aHVyvrjcoDN4V45CdD9kWbXgc31Aej7QEHG8lS5Z5wsU aoMtjQ8LQr/VmsYHKg1A==; Original-Received: from cpc103048-sgyl39-2-0-cust502.18-2.cable.virginm.net ([92.233.85.247]:51246 helo=rivendell.localdomain) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVxJd-0004yn-KI; Wed, 07 Sep 2022 11:50:28 -0400 Original-Received: from localhost (rivendell.localdomain [local]) by rivendell.localdomain (OpenSMTPD) with ESMTPA id ea906c4f; Wed, 7 Sep 2022 15:50:08 +0000 (UTC) X-Attribution: jao X-Clacks-Overhead: GNU Terry Pratchett X-URL: 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:294851 Archived-At: Hi, The kitty terminal emulator (which runs under X11 and wayland) offers a simple protocol for displaying images, fully described at .=20=20 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: _Gf=3D100,t=3Df,c=3D50,r=3D100;\ 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? 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. Thanks, jao --=20 =E5=8D=83=E9=87=8C=E4=B9=8B=E8=A1=8C=E5=A7=8B=E6=96=BC=E8=B6=B3=E4=B8=8B The journey of a thousand miles begins with a single step. =E2=80=94 =E8=80=81=E5=AD=90 (Lao Tsu) in Chapter 64 of =E9=81=93=E5=BE= =B7=E7=BB=8F (Tao Te Ching)