broot icon indicating copy to clipboard operation
broot copied to clipboard

Image rendering not "full quality" on Wezterm

Open ZePhant opened this issue 3 years ago • 10 comments

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?

ZePhant avatar Feb 20 '22 06:02 ZePhant

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

Canop avatar Feb 20 '22 06:02 Canop

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:

  • Image previews are perfect on Arch with ImageMagick installed, on Kitty
  • They are "blocky" on Wezterm w/o ImageMagick installed (unlike Kitty with ImageMagick installed) on Arch (tested on Arch Linux - Kitty is not available for Windows)

So it might actually be an issue for WezTerm itself, as opposed to Windows.

ZePhant avatar Feb 20 '22 08:02 ZePhant

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.

xxyxxyxyx1 avatar Feb 20 '22 12:02 xxyxxyxyx1

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

Canop avatar Feb 20 '22 13:02 Canop

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.

xxyxxyxyx1 avatar Feb 20 '22 13:02 xxyxxyxyx1

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 avatar Feb 20 '22 14:02 Canop

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

Canop avatar Feb 21 '22 06:02 Canop

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

pschmitt avatar Nov 30 '23 13:11 pschmitt

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

Canop avatar Nov 30 '23 16:11 Canop