Skip to content

Image Preview improvements - #653

Open
VAWVAW wants to merge 10 commits into
ulyssa:mainfrom
VAWVAW:preview-improvements
Open

Image Preview improvements#653
VAWVAW wants to merge 10 commits into
ulyssa:mainfrom
VAWVAW:preview-improvements

Conversation

@VAWVAW

@VAWVAW VAWVAW commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

This PR has a lot of small changes. I can break it into multiple PRs if you want.

  • update ratatui-image to 9.0 (further updates need a modalkit release to bump ratatui)
    • this uses the runtime library chafa for halfblock rendering which I have disabled by default since it doesn't improve the quality much
    • settings.image_preview.protocol.type is no longer required on windows (Picker::from_termios() for windows ratatui/ratatui-image#32)
    • generating a picker from the font size has been deprecated and I have removed the setting
  • settings.image_preview.protocol.filter exposes the sample filter used to scale image previews
    • there is a tradeoff between image visibility and runtime
    • in my tests using Triangle over Nearest greatly improves image visibility at a marginally higher runtime

fixes #650

@benjajaja

Copy link
Copy Markdown
Contributor

Chafa does improve a lot over halfblocks! It's just a huge pain in the ass to add, so I wouldn't bother unless you want to have "fun" with linking.

The latest version has "sliced protocols", which would be a real killer feature here, since chats scroll all the time. It allows for partial rendering, so if the image is partially out of view, you can still render the visible parts (lines).

@VAWVAW

VAWVAW commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

In my test I've seen mixed results with chafa. Most pictures were clearer but for some it picked weird colors that made the picture harder to recognize.
I have added cargo features for anyone who wants to bother.

I have an eye on the sliced protocols but for that we need a new modalkit release to keep the ratatui version in sync.

@benjajaja What is the current state of Picker::from_query_stdio() on Windows? The issue I linked was closed before 9.0 was released. But the CI test times out. Is that a problem with the CI environment or should we stick to the now-deprecated Picker::from_fontsize() on Windows?

@benjajaja

benjajaja commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

That is a good question. I think we should stick to from_fontsize() right now, but there was recently some patch to address that, IIRC - to make from_query_stdio() use the ioctl of from_fontsize(), which seems to work on windows despite the queries not working.

I'll check it, cut a release, and report back here.

@benjajaja

Copy link
Copy Markdown
Contributor

To be clear, that patch change I mentioned is not in any release yet, so we should keep using from_fontsize() for the time being, for windows.

@VAWVAW

VAWVAW commented Aug 27, 2026

Copy link
Copy Markdown
Contributor Author

Yeah, I updated this PR to not call from_query_stdio() on windows. As long as from_fontsize() stays around until this issue is fixed, we should be fine.

@VAWVAW
VAWVAW force-pushed the preview-improvements branch from 6cdb1c8 to e4d47a1 Compare August 30, 2026 13:53
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

Successfully merging this pull request may close these issues.

Image reactions are sometimes rendered in the wrong line

2 participants