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

Pixelated image instead of high resolution with iTerm2. #8

Closed
ys-2020 opened this issue Jan 4, 2024 · 5 comments
Closed

Pixelated image instead of high resolution with iTerm2. #8

ys-2020 opened this issue Jan 4, 2024 · 5 comments
Labels
terminal query Related to terminal queries

Comments

@ys-2020
Copy link

ys-2020 commented Jan 4, 2024

Hi. Thank you for the amazing work. I am trying to print some images to the iTerm2 terminal. However, by using the default settings, I only get pixelated images instead of high-resolution ones. #7 might be related to this problem but I did not use tmux. I am wondering if any one could help! Thanks!

Description
Cannot display high resolution image. #7 might be related.

To Reproduce

pipx install termvisage
wget https://user-images.githubusercontent.com/61663146/235449392-b464ff19-82ac-4c55-9244-e718bc999e98.png
termvisage 235449392-b464ff19-82ac-4c55-9244-e718bc999e98.png

Expected behavior
Expect to see a high resolution image instead of pixelated image.

Screenshots

Screenshot 2024-01-04 at 12 49 27 PM

Desktop (please complete the following information, if applicable):

  • OS: Ubuntu
  • Version 22.04

Package info:

  • Python version: 3.9.17
  • Package version: 0.1.0
  • Installation method: PyPI

Terminal Emulator:

  • Name: iTerm2
  • Version: 3.4.23
@ys-2020 ys-2020 added the bug Something isn't working label Jan 4, 2024
@AnonymouX47
Copy link
Owner

AnonymouX47 commented Jan 4, 2024

Hello! Thanks for the compliments.

How could you be running iTerm2 on Ubuntu? 🤔

Please run

  1. echo -e '\e[>q'
  2. echo $TERM_PROGRAM

separately within the same terminal and let me know what you see for each.

@ys-2020
Copy link
Author

ys-2020 commented Jan 4, 2024

Hi! Thank you very much for the prompt reply!

Sorry for the unclarity. Actually I am running iterm2 on my Mac and ssh to Ubuntu server. And I am just wondering if there is any possibility to show image on my local terminal while ssh-ing to a remote ubuntu server?

The echo -e '\e[>q' returns echo -e '\e[>q'>|iTerm2 3.4.23.
And echo $TERM_PROGRAM returns empty outputs.

@AnonymouX47
Copy link
Owner

I see... thanks for the clarification.

Yes, it's possible to display [high-res] images in remote sessions.

From the screenshot and the information you've given, it seems the problem is that the terminal responds late to queries due to the session being remote. The seemingly garbage text at the top-left of the image output in your screenshot is actually a response from the terminal to a query sent by the image viewer... the fact that it shows there means it came in later than the timeout. See "Why does my program get garbage input (possibly also written to the screen) or phantom keystrokes?" in the library's FAQs.

To solve the problem, you can increase the timeout (default is 0.1) using the --query-timeout CLI option or the query timeout config option.

Please, try the suggested solution above and let me know the result.

Thank you.

@ys-2020
Copy link
Author

ys-2020 commented Jan 5, 2024

I see. Modifying --query-timeout seems to work! Thank you so much!

@ys-2020 ys-2020 closed this as completed Jan 5, 2024
@AnonymouX47
Copy link
Owner

You're welcome.

@AnonymouX47 AnonymouX47 added terminal query Related to terminal queries and removed bug Something isn't working labels Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
terminal query Related to terminal queries
Projects
None yet
Development

No branches or pull requests

2 participants