Closed newyorkthink closed 1 year ago
I don't think that tmux allows the picture modes of kitty or wezterm. This is why images are shown in the character based pixelation.
Also 256 colors is limiting the color range, you'd like a 24 bit color mode if available.
There's a tmux
plugin/kitten called icat
which if used inside kitty > tmux
(tmux
running inside kitty
) can draw images in full resolution using the kitty
protocol.
kitty +kitten icat image.jpeg
But under the same kitty > tmux
setup, the same image if displayed with timg
, will appear blurred with --pixelation=quarter
(default behavior), or as text if --pixelation=kitty
is used (example screenshot below).
📍 Since icat
works under the kitty > tmux
setup, timg --pixelation=kitty
should also work under the same kitty > tmux
setup as well. Thanks!
Interesting, I'll have to look what the difference is of what icat outputs on tmux vs. timg.
@hzeller Thanks. For the sake of completeness...
kitty 0.28.1
kitten icat 0.28.1
I looked what kitty is doing there. It has to do an extremely ugly hack to work around tmux' refusal to work with image protocols. I'll have to see if I can integrate that in timg without breaking anyone else who is implementing that protocol.
Can you try this AppImage zip ?
It should now work within tmux
running inside the Kitty terminal (other terminals that support the Kitty protocol will likely not work as the Unicode Placeholder stuff is fairly new and probably only implemented properly there).
You have to manually provide the -pk
option in timg
for it to emit the Kitty protocol (because timg can't probe the terminal (Or, manually set the TERM
environment variable to xterm-kitty
).
# inside tmux
$ timg -pk some-image.jpg
@hzeller Thanks for the quick turnaround! Please see my test results below.
⚠️ This configuration also works, but with the following error:
no server running on /tmp/tmux-1001/default
Could not set tmux passthrough for graphics
📌 I think before doing system("tmux set -p allow-passthrough on")
, we need to check if we are running inside tmux
, e.g. at the SSH Linux host, we were not running tmux
in this configuration.
⛔️ This configuration does not work (displays no/blank image) and prints the following error/warning:
invalid option: allow-passthrough
Could not set tmux passthrough for graphics
📌 I think this is because tmux
didn't support the allow-passthrough
option in 3.2a
. So, before doing system("tmux set -p allow-passthrough on")
, we need to somehow check the underlying tmux
version. Thanks!
In case anyone else is struggling to reproduce the same behavior from the latest timg
patch under Kitty v0.28.1
and v.29 (latest)
, this might be the reason. Thanks.
Second case: ok, let me see if there is a simple way to detect the case where we're actually remote.
The last case, tmux before 3.3, probably just means that if passthrough didn't exist then, it would not possible to show images in tmux anyway, so showing an error message there is probably good, but I agree if we could take the version into account, we could provide a more tailored error message.
Alright, the cases 2 and 3 should be a bit more useful now
There is an updated AppImage to test.
Now in the latest release v1.5.1
yes, tmux is refusing to work with image formats, so the Kitty workaround is the only way.
@hzeller Thanks again.
FYI @kovidgoyal : implemented use of your unicode placeholders protocol to have timg
work within tmux
within kitty
.
Cool, glad to hear it.
Anyone have working usage examples for scope.sh
in tmux? I'm having... problems...
Just to give my 2 cents feedback.
This is working perfectly on my Archlinux system. That is, when I'm running tmux inside kitty and,
timg --pixelation=kitty someimage.jpg
I see a perfect not blurred image.
It "seems" to take a few almost unnoticeable micro/nano milliseconds more time than showing it without tmux in the middle. This is a 14 year old PC' ahha.
timg --version
timg 1.5.2+ <https://timg.sh/>
Copyright (c) 2016..2023 Henner Zeller. This program is free software; license GPL 2.0.
Image decoding GraphicsMagick 1.3.41 (2023-08-12)
Openslide 3.4.1
Turbo JPEG
QOI image loading
swscale 7.1.100
Video decoding libav 60.3.100; avdevice 60.1.100
Half, quarter, iterm2, and kitty graphics output: timg builtin.
Libsixel version 1.10.3
Installed from here, https://aur.archlinux.org/packages/timg
$ kitty --version
kitty 0.29.2 created by Kovid Goyal
$ tmux -V
tmux 3.3a
I always have this line in my ~/.tmux.conf
set -g default-terminal "tmux-256color"
and that's what is reported by echo $TERM.
From the 3 terminal image viewers that I use
timg is the only one that "manages" to do it. That is, to overcome tmux "obstacles" and display a perfect image , when running inside tmux inside kitty.
tmux
will limit the number of unicode characters and colors it can show. This is nothingtimg
or other terminal image displaying tools will be able to influence. Maybe it is something that you can configure intmux
already or have to implement there.So this is not an issue with
timg
but something you have to figure out with tmux.