Canop / broot

A new way to see and navigate directory trees : https://dystroy.org/broot
MIT License
10.66k stars 234 forks source link

Image rendering not "full quality" on Wezterm #509

Open ZePhant opened 2 years ago

ZePhant commented 2 years ago

I tried previewing .pngs on Broot using Wezterm on Windows and while Wezterm offers HD image previews with its imgcat function, Broot displays a poor image preview (blocky image preview). On Windows (WezTerm)

Whereas WezTerm's imgcat is much sharper: image

What am I missing, since the website mentions that Wezterm supports clear images here?

Canop commented 2 years ago

@ZePhant Another occurrence of this : I didn't test on Windows.

ZePhant commented 2 years ago

Thanks for your prompt reply, @Canop .

I imagined that it might be a problem with Windows, so I tried it on my WSL Arch Linux instance. It doesn't seem to be specific to Windows. Here's what I found:

xxyxxyxyx1 commented 2 years ago

I have a similar issue on macOS 12.2. I have installed broot 1.9.3, wezterm 20220101-133340-7edc5b5a, and kitty 0.24.2. Basic image previews look the same in both terminals, using either wezterm imgcat or kitty +kitten icat. However, broot previews are shown in high quality only with kitty. With wezterm, I only get the blocky images.

edit: I do not know if there is a problem with broot detecting and using the kitty protocol within wezterm, or if there is a problem with wezterm providing an implementation of the kitty protocol. If anyone can suggest a simple method of determining which is the case, it seems like the next step.

Canop commented 2 years ago

@xxyxxyxyx1 Lauch broot with the log enabled. The log will precise the detection process when previewing an image. Paste it here.

xxyxxyxyx1 commented 2 years ago

Here is the relevant part of the log file:

14:50:31.185 [INFO] broot::app::app: event: TimedEvent { time: Instant { t: 5875907905667 }, event: Key(KeyEvent { code: Right, modifiers: CONTROL }), double_click: false }
14:50:31.186 [DEBUG] broot::app::app: command after add_event: VerbTrigger { index: 39, input_invocation: None }
14:50:31.251 [DEBUG] broot::image::image_view: decode image on "/Users/user/tmp/broot-test/Herakles_Kerberos_Louvre_F204.jpg" took 64.466375ms
14:50:31.252 [DEBUG] broot::app::app: display panel took 159.25µs
14:50:31.252 [DEBUG] broot::image::image_view: image_view must be cleared
14:50:31.252 [DEBUG] broot::kitty::detect_support: is_kitty_graphics_protocol_supported ?
14:50:31.252 [DEBUG] broot::kitty::detect_support: $TERM = "xterm-256color"
14:50:31.252 [DEBUG] broot::kitty::detect_support: $TERM_PROGRAM = "WezTerm"
14:50:31.253 [DEBUG] broot::kitty::detect_support: $TERM_PROGRAM_VERSION = "20220101-133340-7edc5b5a"
14:50:31.253 [DEBUG] broot::kitty::detect_support: WezTerm's version predates Kitty Graphics protocol support
14:50:31.271 [DEBUG] broot::image::image_view: resize image took 18.441375ms
14:50:31.272 [DEBUG] broot::image::image_view: resized image dimensions: 146,107
14:50:31.274 [DEBUG] broot::app::app: display panel took 22.168708ms

I have confirmed I am using the current stable release on the wezterm github with wezterm --version. So, I think the "WezTerm's version predates Kitty" is incorrect.

Canop commented 2 years ago

The problem is broot needs a fix from January the 5 (https://github.com/wez/wezterm/commit/e28e09dfa832044c16fbd5907bc8bf0a958c7c2b).

It's unfortunate there doesn't seem to have been any official release since.

Canop commented 2 years ago

wez confirmed there's still not been any official release with this fix: https://github.com/Canop/broot/issues/473#issuecomment-1046247630

pschmitt commented 10 months ago

If you built wezterm from source and didn't bother setting the version info you'll end up with an empty TERM_PROGRAM_VERSION, broot will then refuse to display full-res images.

To force it:

TERM_PROGRAM_VERSION=20231130 broot

Canop commented 10 months ago

Thanks. There's a reference for env variable there: https://dystroy.org/broot/launch/#environment-variables

AeliusSaionji commented 3 months ago

Confirmed still not working under Windows (not just confirming for the sake of it, I'm going through all issues tagged to assess what is still pertinent).

Tried the following envs:

TERM_PROGRAM_VERSION=20240624-065522-552bb1d6
TERM_PROGRAM=wezterm
TERMINAL=kitty

and with/without the following setting: kitty_graphics_transmission: chunks