From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: Implementing image support for kitty terminal Date: Wed, 07 Sep 2022 21:11:07 +0300 Message-ID: <83o7vrgimc.fsf@gnu.org> References: <87v8pz18wf.fsf@mail.jao.io> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19272"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Jose Antonio Ortega Ruiz Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Sep 07 20:13:37 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 1oVzYN-0004nC-2z for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Sep 2022 20:13:35 +0200 Original-Received: from localhost ([::1]:34582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oVzYM-0002HO-2l for ged-emacs-devel@m.gmane-mx.org; Wed, 07 Sep 2022 14:13:34 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60782) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVzWG-0000bg-Jd for emacs-devel@gnu.org; Wed, 07 Sep 2022 14:11:24 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:49046) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVzWG-0001pS-BR; Wed, 07 Sep 2022 14:11:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=Pl+phWoBpM3r7Lbaxy3vXWitj51b7WWNXNt4jXWj/jw=; b=XGJYSYh+lI6/ 0R6n/3iBmgCenDfSyX//m16stf1oaV00IBMr2u9tiyTXy/SLrje/4dfRO8YqqwaHf5QsMN+ink3U0 cGuK10UHNRZcjus4S/bEgKN7FbC3K6XNlrRDZ3+O1vVG2HuqAoptOlXjtj/Xe4/AAt/pD8aX7uDrN sarqwJqj5uVebzu1bI0WwMa+wTccQymkjZ2MU3GI14PqeNgolQGDC5Is1sSMC3cqrxkqP9pTJP9BS KpxRoeomMrk4OFntLXDcPaFoPmn9PC88DmBmAujIIncD6SlR8q+hHLzPtN1WhmySmiaMsaqq5eqxq y8ApRwdlRO0MTxcfT+EioQ==; Original-Received: from [87.69.77.57] (port=4486 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oVzWF-0001R3-Op; Wed, 07 Sep 2022 14:11:24 -0400 In-Reply-To: <87v8pz18wf.fsf@mail.jao.io> (message from Jose Antonio Ortega Ruiz on Wed, 07 Sep 2022 16:50:08 +0100) 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:294863 Archived-At: > From: Jose Antonio Ortega Ruiz > Date: Wed, 07 Sep 2022 16:50:08 +0100 > > The kitty terminal emulator (which runs under X11 and wayland) offers a > simple protocol for displaying images, fully described at > . > > 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=100,t=f,c=50,r=100;\ > > 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? It's hard to tell, because you haven't described your ideas of implementing that. 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. 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. > 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. I don't think anyone will disagree that extending the capabilities of TTY frames in this direction will be a very good and useful feature.