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

Images appear garbled in terminal.app on macOS #483

Closed
nathnp opened this issue May 2, 2024 · 8 comments
Closed

Images appear garbled in terminal.app on macOS #483

nathnp opened this issue May 2, 2024 · 8 comments
Assignees

Comments

@nathnp
Copy link

nathnp commented May 2, 2024

Images viewed in macOS terminal.app appear garbled when using toot tui.

This does not occur when using Kitty on macOS. Or on my Fedora 40 Linux machine.

toot version: toot v0.43.0
macOS version: 14.4.1

Screenshot 2024-05-01 at 23 42 17 terminal.app in macOS
Screenshot 2024-05-01 at 23 42 35 Kitty on macOS
@danschwarz
Copy link
Collaborator

danschwarz commented May 7, 2024

The limitation here is that MacOS terminal app supports only 256 colors - not truecolor.

It is possible to support image rendering with a 256 color palette, but we will need support from term-image to implement that. The feature request is open with term-image here: AnonymouX47/term-image#90

In the meantime I recommend using iterm2 on MacOS.

Tagging @AnonymouX47

@danschwarz danschwarz self-assigned this May 7, 2024
@mihkelraba
Copy link

I'll add this comment here, because it fits to the same topic.
Kitty shows images, but they are very low res / blurry.

image

In browser
image

@danschwarz
Copy link
Collaborator

Are you launching the tui like this: toot tui -f kitty? If not,toot tui defaults to the Unicode block graphics you're seeing.

Alternatively, you can set the image_format variable in the settings.toml file to 'kitty' if you're confident you will only launch the tui from within kitty terminal.

@mihkelraba
Copy link

Are you launching the tui like this: toot tui -f kitty? If not,toot tui defaults to the Unicode block graphics you're seeing.

Alternatively, you can set the image_format variable in the settings.toml file to 'kitty' if you're confident you will only launch the tui from within kitty terminal.

Tried your command & also adding image_format = "kitty" into config file.
Images are not displayed anymore, but instead some data is displayed on menubar

image

@danschwarz
Copy link
Collaborator

OK, so what's going on there is that your terminal is misinterpreting command sequences as text data. Possibilities:

  1. Are you using a recent version of kitty? If you're using an old version, try updating to the latest.
  2. Are you running a screen multiplexer like screen or tmux? These could interfere with the terminal command sequences.
  3. Timing could be to blame; are you running the terminal directly on the system that is executing toot tui? Or are you connecting over one or more network hops? Are any of these hops particularly slow?

@AnonymouX47
Copy link
Contributor

Hello here!

Firstly, I should apologize for not responding since I got pinged. It was actually intentional as I didn't want to make any promises I would end up breaking but rather planned to respond with the feature implemented.

As earlier implied, I have now implemented indexed-color (256-color) support in AnonymouX47/term-image#109 (please, take note of the admonition there).

@nathnp, I don't know what installation method you used for toot but if possible, please run

pip install git+https://github.com/AnonymouX47/term-image.git@indexed-color

or its equivalent within the same environment as you have toot installed and report back on how image display is within toot after that.

Thank you very much. 😃

@danschwarz
Copy link
Collaborator

@AnonymouX47 is the indexed color support reliant on any terminal queries? I have disabled term-image terminal queries in the toot tui integration. I expect I'll have to provide an option flag to control indexed color mode usage.

@AnonymouX47
Copy link
Contributor

AnonymouX47 commented May 31, 2024

@AnonymouX47 is the indexed color support reliant on any terminal queries?

Not at all.

I have disabled term-image terminal queries in the toot tui integration.

Yeah, I noticed. You actually don't have much to loose.

I expect I'll have to provide an option flag to control indexed color mode usage.

Yes, sure. The most straight-forward method (which is the best in the case of toot) would be:

# Use indexed-color
BlockImage.set_render_method("INDEXED")

# Use direct-color (default)
BlockImage.set_render_method("DIRECT")

and you only have to call this once on the class.

ihabunek added a commit that referenced this issue Jun 8, 2024
Added support for indexed color image rendering; fixes #483
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants