kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.15k stars 972 forks source link

display region support in `kitty icat` #228

Closed soredake closed 6 years ago

soredake commented 6 years ago

To support displaying images in ranger and vifm

kovidgoyal commented 6 years ago

Can you elaborate on exactly what you want? Displaying a part of an image? Choosing what part of the screeen to display it in? All these things are already supported by the graphics protocol, which is what applications like ranger should use. But I am willing to add command line options for these to kitty icat as well, if needed.

See https://github.com/kovidgoyal/kitty/blob/master/graphics-protocol.asciidoc#controlling-displayed-image-layout

for how to display parts of images in the graphics protocol.

soredake commented 6 years ago

I want 4 command line options (described later) inkitty icat

Reference parameters from vifm that w3mimgdisplay needs (not sure that all parameters are needed):

%px x coordinate of top-left corner of preview area;
%py y coordinate of top-left corner of preview area;
%pw width of preview area;
%ph height of preview area.

e.g. kitty icat $file %px %py %pw %ph
kovidgoyal commented 6 years ago

These co-ords are in cells or pixels?

soredake commented 6 years ago

They are expressed in number of characters. https://github.com/ranger/ranger/blob/master/ranger/ext/img_display.py#L151-L194

soredake commented 6 years ago

e.g. i want functionality to display images in needed in the right place like the ranger and vifm doing with w3mimdisplay help kittyicat

soredake commented 6 years ago

@kovidgoyal tried with vifm (fileviewer *.jpg,*.jpeg kitty icat --place=%pwx%ph@%pxx%py %c) and kitty icat returns Must be run in a terminal, stdout is currently not a terminal

kovidgoyal commented 6 years ago

I have no idea how vifm works, but kitty icat will return that error if isatty() returns false for stdout or stdin. Is vifm redirecting those?