Skip to content

Use ratatui-image to show images in-terminal#44

Draft
chinatsu wants to merge 5 commits intosugyan:mainfrom
chinatsu:feature/images
Draft

Use ratatui-image to show images in-terminal#44
chinatsu wants to merge 5 commits intosugyan:mainfrom
chinatsu:feature/images

Conversation

@chinatsu
Copy link

@chinatsu chinatsu commented Dec 23, 2024

It would be nice to see images in-situ for terminals that support images. It seems ratatui-image handles various terminals pretty well, so the usage is pretty simple.

I've not really thought this through very well, and I'm not really sure I've got the motivation or knowledge to see this PR through to a ready state.

  • Render preview picture in image embed modal
  • Render picture(s) in new post view? (after adding picture with image embed modal)
    • My idea here is that one can add multiple photos. It would be nice to be able to see a preview of them all before posting
  • Render picture(s) in post view
    • Question: We only have the URLs to the pictures at the moment, right? Are there helper functions in the SDK or elsewhere to let us download the contents to display? This applies to the next point as well, I think.
  • Render pictures in feed?
    • Just thumbnails, bigger photos in post view.
  • Honor content moderation preferences
    • Blur/show default "sensitive content" image? How to let the user see the content if they choose? 🤔
  • Config setting to disable pictures
    • Maybe pictures are too much visual clutter for some, so maybe they want to disable rendered pictures altogether?

I'm not super familiar with this program yet. I started using it today. So I might not know the ins and outs of the way the architecture is meant to work.

The initial commit is only a simple test to see if it's possible at all, and I think I kind of like it!

Screenshot from 2024-12-23 22-58-40

@chinatsu chinatsu marked this pull request as draft December 23, 2024 22:32
i don't really like how check_path is growing, but that's where we originally read an image.. so...
refactoring should maybe take place lol
@chinatsu
Copy link
Author

I don't like it when branches live very long, so maybe it's best if we limit the feature scope for this PR.
The tasks I initially outlined was just brainstorming.

It seems a little bare to leave it the way it is now, though.
I'll focus on the two first tasks for now.

@sugyan
Copy link
Owner

sugyan commented Dec 24, 2024

Thanks for the great suggestion and implementation.
ratatui-image is an excellent library and I once considered using it for a feature, but at the time I decided that my priority was to enhance the functionality in the Text-only UI first, so I passed on it.

Also, since the column width can be flexibly changed, I thought it would be necessary to consider many aspects of UI design to make it possible to display the columns without making them difficult to see even when they are narrow.
So I was thinking that it would be nice to have at least the ability to render the full column width of the image selected by the user on the post's detail view page.

If it is not a problem from a UI standpoint, I would be happy to add, as you write, previewing embeds when creating a post.
Still, for users who prefer a text-only UI, I think the ability to turn on/off the image display feature should be controllable via settings.

@chinatsu
Copy link
Author

It sounds like we're pretty aligned!
I also have a few ideas about the text based UI, but I'll keep my ideas coming sequentially for now, haha.

I personally would love to see posted images near the feed as well, but I'll skip looking into that in this PR.

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.

2 participants