jstkdng / ueberzugpp

Drop in replacement for ueberzug written in C++
GNU General Public License v3.0
751 stars 26 forks source link

Multiple image support #74

Closed 3rd closed 1 year ago

3rd commented 1 year ago

Hey, I'm working on a way to add image support to Neovim, so I picked ueberzugpp as the starting rendering backend and got a nice first version working.

I noticed that there is no multiple image support, and the image identifiers are not really used, when adding an image the canvas is cleared and only that image is rendered, and clear clears everything.

Is multiple image support on the roadmap?

It works great otherwise, and the tmux integration is amazing. It does crash when sending multiple commands quickly, but that's workable.

Thanks!

jstkdng commented 1 year ago

Hello, I do have that in the roadmap, but it requires some restructuring of my code so it will take some time. Are you doing like a collage?

It does crash when sending multiple commands quickly, but that's workable.

really? rip

3rd commented 1 year ago

Ah, awesome! Not a collage, but trying to render images for document grammars like Markdown. I might have to write a small "compositor" to manage the images, maybe I could then always spit out a single image, but I was trying to avoid the tmux handling. Thanks for the project!

image

jstkdng commented 1 year ago

Nice, though, multiple images won't work with everything. Probably only x11, iterm2 and maybe wayland.

jstkdng commented 1 year ago

hey, I have a working multiple image implementation for X11 on the refactor1 branch, give it a try.

3rd commented 1 year ago

@jstkdng Amazing work, thanks a lot! It's pretty good right now!

https://github.com/jstkdng/ueberzugpp/assets/59587503/69940151-2e78-45e6-9ca4-e3e34f6af9a1

Can I contribute with a small change to crop the images? Right now I make sure they never get out of bounds, but this means they get resized.

It would look like this: https://gist.ro/kitty-crop.mp4

Thanks again for your work!

jstkdng commented 1 year ago

Sure, open a PR and we can look over the changes. Are you using OG ueberzug for testing?

3rd commented 1 year ago

Sure, open a PR and we can look over the changes. Are you using OG ueberzug for testing?

No, the original won't be supported, just ueberzugpp, kitty graphics protocol and sixels. Thanks again!

jstkdng commented 1 year ago

Does kitty and sixel even work on neovim?

3rd commented 1 year ago

Does kitty and sixel even work on neovim?

Yep, the second link is kitty's normal protocol, but I got one with unicode placeholders working as well. The placeholder one has the same cropping issue, but works with tmux, so I'm considering doing the cropping myself...

jstkdng commented 1 year ago

How, ueberzugpp's sixel and kitty implementation doesn't work with neovim. Is some configuration required for it to work?

3rd commented 1 year ago

Hmm, interesting, it works for me, doing it like this: https://github.com/3rd/image.nvim/blob/master/lua/image/backends/kitty/helpers.lua#L42

3rd commented 1 year ago

@jstkdng Thanks for all the help, will get back with a cropping PR!

Got the experimental version working and put it out there, there's an ongoing discussion on it here: https://www.reddit.com/r/neovim/comments/14mjsvr/adding_image_support_to_neovim_kitty_tmux_amazing

jstkdng commented 1 year ago

I see, it seems kitty is only supported with the unicode placeholders.

3rd commented 1 year ago

I see, it seems kitty is only supported with the unicode placeholders.

Works without placeholders!

jstkdng commented 1 year ago

Hmmmm, unless the neovim terminal is somehow different than editor buffers then I don't understand. ueberzugpp also supports kitty, can you test with your software outside of tmux and check if ueberzugpp's kitty/sixel implementation works?