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
support ueberzug image displayer #1284
Conversation
Looks pretty cool for a first contribution. Does überzug only support python 3.x? That's somewhat unfortunate. If it's not could you run it with the same python that's running ranger, or just the python on the |
I used python3 features like asyncio to avoid dealing with thread safety, so it won't run with python2. |
Is the threading module an option, afaik that's been backported? |
Somehow it always draws the picture to the upper left corner, regardless of the given x,y parameters. Happens both in ranger and with this simpler demonstration (using termite):
|
@jaelpark I think this belongs to https://github.com/seebye/ueberzug/issues.
@toonn Honestly, I don't really wan't to support python2. Edit: You're right didn't saw the additonal package in debians repository. |
Entire browser? w3m-img doesn't depend on w3m. |
@seebye I created a quick fix and opened a PR, see if it's something you want to merge. At least the problem with termite is fixed. This could be configurable, whether to get the dimensions with Xlib or using the original method. |
In the newest version there are some changes for python3.7. |
I have no idea why the property would be missing. No funny business on my end afaik. |
I think it should work with version 6 if it's not terminology itself which lacks the property. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works with v6 yes. It seems to work quite nicely. The quality is a little less than with native terminology previews but I'm not sure that can be achieved in a method compatible with multiple terminals. It's mostly noticeable with text:
I did notice a problem though. I was testing the method and wanted to compare to the terminology method on that screenshot of text because I thought I noticed a quality difference. The ueberzug window didn't close, it just stayed open overlapping that part of ranger. Switching back to the ueberzug method didn't help either, the new ueberzug windows were drawn under the one that stuck. I really think this should be fixed before we include the method in the release.
On the latest version of ranger the preview image also stays if you switch from terminology to e.g. w3m. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous problem was fixed, so we're making progress but I ran into another problem when ueberzug tries to preview an svg I get this error:
It's probably not possible to have ueberzug preview svg's but it shouldn't mess up the interface. Either log the mesasge with self.fm.notify
or suppress it entirely.
For me the image never stayed when I switched from terminology to another method. If you did have that problem then that sounds like a good fix though. |
I enabled the redirection of stderr to /dev/null. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might make troubleshooting a little harder when people do expect a preview but it's an ok fix imo.
And I checked again and indeed changing away from the terminology method left an image too.
This is an awesome first contribution. Thanks for the work. I'm gonna allow for a little time for another team member to check out the changes but this is probably going in the next release. 👍 |
Looks really interesting! Sadly I cannot get it to work. I'm using |
It also needs documentation in the rc.conf comment and a new allowed value here. |
@vifon, you did actually install ueberzug first, right? And good catch about the documentation and the |
I am using suckless terminal on Arch, ueberzug sample bash script displays image using the terminal. However ranger fails to display the image in preview. Installed both using "sudo pip install ranger ueberzug" ranger version: ranger 1.9.2 |
You need the master version of ranger this is not in the release. |
I tried with the master version from github, same effect. I also tried ranger-git in AUR, no luck :( |
You did |
Yes, my ~/.config/ranger/rc.conf has
And yeah I removed the earlier ranger and cloned master and did a make install. The preview window is blank. |
@seebye, could you chime in? I have no idea why it'd work in the terminal but not ranger. |
@sooriravindra, I have the same setup as you, st, ranger-git from AUR and ueberzug from pip. I can see preview images but only if they fit inside the preview pane. It seems like the images are not resized to fit. Can you check if you can preview a low enough resolution image? Edit: I checked with urxvt and kitty and the same happens. |
@ivomac that seems like it, I was trying to preview images that don't fit in the preview window. Now when I tried a smaller image, the preview works. The issue seems to be with resizing. |
Hmm, maybe try uninstalling pillow-simd and installing pillow instead? |
I tried uninstalling pillow-simd and installing pillow but now ueberzug complains it is missing pillow-simd. Is there a way to tell it to use pillow? This doesn't seem to be an issue with ranger. Opening an image with ueberzug on the terminal and forcing a resize using max_width and max_height gives a segmentation fault. Used bash script:
images smaller than 200x200 are displayed correctly, larger ones give the error
|
Try to install ueberzug by using pip it shouldn't complain then. |
python-ueberzug-nosimd-git worked perfectly. Thank you! |
@seebye, is there any chance you'd consider making It'd be far easier if it just always works and we mention you might be able to get a speed improvement with |
@toonn Sure, I guess. I'm busy right now, so I'm likely doing it not until next week. |
@seebye python-ueberzug-nosimd-git works great. However the pip install complains if pillow-simd is not installed ( I had pillow installed). Thank you! |
Hi, when I try to preview an image in ranger, at the bottom of the terminal appears |
What do you mean by source? Ueberzug is definitely not designed to be sourced by a shell. How did you install ueberzug? |
I installed following the instructions from ueberzug's github, and by source, I mean this in bash: |
Does that at least print the path to the library? |
Hey, suddenly, now it shows images whose resolution is smaller than the right side of the terminal, check this out: |
@eduardoejorqueras Have you tried making Ueberzug to use pillow instead of pillow-simd? |
@sooriravindra thank you, I just uninstalled pillow-simd and works very nice 😄 , here the evidence: |
@remlap The font size & padding is guessed. See: #1284 (comment) |
It would work previously fine. |
@toonn I released a new version (on pypi/pip) which uses pillow instead of pillow-simd. |
@seebye, thank you a lot for this. I understand a more performant default is attractive so I would've totally understood if you said no. This'll probably save us a ton of issue reports ❤️ |
Can you share that how do you resolve the problem? I meet the same problem that show |
Überzug is a command line util which allows to draw images on terminals by using child windows.
It has some advantages over w3mimgdisplay, e.g.:
More: https://github.com/seebye/ueberzug#%C3%9Cberzug
ISSUE TYPE
RUNTIME ENVIRONMENT
CHECKLIST
CONTRIBUTING
document has been read [REQUIRED]DESCRIPTION
MOTIVATION AND CONTEXT
w3mimgdisplay does not work with alacritty, tmux is also not supported
TESTING
IMAGES / VIDEOS