Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native support for the image preview #188

Open
kyoheiu opened this issue Feb 24, 2023 · 6 comments
Open

Native support for the image preview #188

kyoheiu opened this issue Feb 24, 2023 · 6 comments
Labels
enhancement New feature or request

Comments

@kyoheiu
Copy link
Owner

kyoheiu commented Feb 24, 2023

Currently we need chafa to preview image files, but #186 enables it out of the box, using viuer.
The problem is, that with viuer the preview of gif animation could take a long time, which is really frustrating. This leads to not supporting high-res preview in both iTerm and kitty protocol.
Reading gif as Frames via image crate would be a solution.

@kyoheiu
Copy link
Owner Author

kyoheiu commented Mar 1, 2023

viuer's sixel feature does not work on runtime because sixel-sys doesn't provide its own compiled libsixel library: cf. AdnoC/sixel-sys#3
This library seems unmaintained for years.

@kyoheiu
Copy link
Owner Author

kyoheiu commented Mar 1, 2023

feature-viuer branch can show the image preview by blocks in any terminal, and if your terminal supports iTerm protocol, even the high-res one. But Many terminals are with libsixel, which is not easily used in Rust code because of the issue above.
I think many user wants the high-res preview if available, so this branch is not completed. I leave this issue open to show the process.
In the current version chafa supports the image preview in felix.

@kyoheiu
Copy link
Owner Author

kyoheiu commented Mar 4, 2023

Refactored the image preview flow: Now in feature-viuer branch it is supported by default, and if your terminal implements iTerm protocol (i.e. Wezterm) it can show the high-res image.
Furthermore, if your terminal supports sixel or kitty protocol, by installing chafa you have the high-res preview.

@aminnairi
Copy link

aminnairi commented Jan 2, 2024

Is there any chance that this could work using Tmux & Kitty?

Using Kitty as-is does work perfectly, I get images in high resolution using Chafa.

Using Tmux within Kitty does not work. I'm not sure to understand the intricacies of how does Chafa or those so-called Kitten for displaying images work, but I guess Tmux does something that prevents this behavior.

Do you think that this could be added to Felix? If not, can you explain ways to make it work or alternatives?

Looks like it is something about a multiplexer passthrough using Kitty & Tmux as discussed here hpjansson/chafa#162

Thank you!

@hpjansson
Copy link

Just chiming in to note that tmux passthrough should indeed be working on Chafa master. It will be in the 1.14.0 release in a couple of days. Cheers!

@RioNight
Copy link

RioNight commented Jan 5, 2024

Refactored the image preview flow: Now in feature-viuer branch it is supported by default, and if your terminal implements iTerm protocol (i.e. Wezterm) it can show the high-res image. Furthermore, if your terminal supports sixel or kitty protocol, by installing chafa you have the high-res preview.

I'm on Windows. When I try to build this branch to get iterm previews I get the error:

user@host MINGW64 ~/repos/felix (feature-viuer)
$ cargo install --locked --path .
  Installing felix v2.3.0 (C:\Users\user\repos\felix)
    Updating git repository `https://github.com/kyoheiu/syntect`
error: failed to get `syntect` as a dependency of package `felix v2.3.0 (C:\Users\user\repos\felix)`

Caused by:
  failed to load source for dependency `syntect`

Caused by:
  Unable to update https://github.com/kyoheiu/syntect#b5212417

Caused by:
  failed to clone into: C:\Users\user\.cargo\git\db\syntect-efeee53e6df11ed1

Caused by:
  failed to authenticate when downloading repository

  * attempted to find username/password via git's `credential.helper` support, but failed

  if the git CLI succeeds then `net.git-fetch-with-cli` may help here
  https://doc.rust-lang.org/cargo/reference/config.html#netgit-fetch-with-cli

Caused by:
  failed to acquire username/password from local configuration

I'm able to build the main branch fine however. I'm using Wezterm and have chafa but the image previews don't display with sixel for some reason. So, I was looking to use iterm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants