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

How to preview images with timg #2936

Open
87074139 opened this issue Jan 11, 2024 · 2 comments
Open

How to preview images with timg #2936

87074139 opened this issue Jan 11, 2024 · 2 comments

Comments

@87074139
Copy link

87074139 commented Jan 11, 2024

Runtime Environment

  • Operating system and version: osx 13.3
  • Terminal emulator and version: alacritty 0.13.1
  • Python version: python3.11
  • Ranger version/commit: 1.9.3
  • Locale: zh-cn and en
@lkschu
Copy link

lkschu commented Apr 4, 2024

I couldn't get timg to work. It seems to be a problem with timg which always tries (and fails) to read the terminal size, even if an explicit size is given. tiv however, is very similar and works without any problems.

In rc.conf, you need:

set preview_images false
set preview_files true

in your scope.sh, you need this:

    image/*)
        tiv "${FILE_PATH}" -w "${PV_WIDTH}" && exit 4
        exit 1;;

Edit: Small addition: you can speed up the image preview by using imagemagicks scale (it's still not that fast though):

    image/*)
        tiv -w "${PV_WIDTH}" <(convert "${FILE_PATH}" -scale 512x512\> /dev/stdout)  && exit 4

In the same way, you can use ffmpegthumbnailer or pdftoppm to generate previews for videos and pdfs and pass them to tiv

@87074139
Copy link
Author

87074139 commented Apr 8, 2024

Thanks for sharing

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

2 participants