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

help wanted: simplest way to display an image using ueberzugpp #56

Closed
justchokingaround opened this issue Jun 1, 2023 · 7 comments
Closed

Comments

@justchokingaround
Copy link
Contributor

i would like to get some help on how i could simply display an image in the terminal, by specifying its position, something that was done in Luke Smith's video using the original ueberzug:

image

#!/bin/bash
source "`ueberzug library`"

ImageLayer 0< <(
  ImageLayer::add [identifier]="example0" [x]="$2" [y]="$3" [max_width]="$5" [max_height]="$4" [path]="$1"
  read
)
@jstkdng
Copy link
Owner

jstkdng commented Jun 2, 2023

hm, that bash library was later deprecated by seebye so I wouldn't use it. The easiest way to display images is through the unix socket ueberzugpp provides, be it with another tool or with ueberzugpp itself.Plus it is not so "simple", ueberzug still has to keep running to handle X11 events. I was thinking of implementing a standalone version of ueberzug but that'd only work with kitty, sixel and iterm2, plus it would not work with animated gifs.

@justchokingaround
Copy link
Contributor Author

and how could i do that with a shell script to just display the image, with ueberzugpp itself? i've been struggling a bit to figure out how everything works, and it's hard to find any documentation online

@jstkdng
Copy link
Owner

jstkdng commented Jun 2, 2023

The lfub script and the fzfub script are examples of that. Unless you want something easier than that.

@justchokingaround
Copy link
Contributor Author

actually, i just figured out how to replicate that, this is what i was trying to achieve:

#!/bin/sh

UB_PID_FILE="/tmp/.$(uuidgen)"
ueberzugpp layer --no-stdin --silent --use-escape-codes --pid-file "$UB_PID_FILE"
UB_PID="$(cat "$UB_PID_FILE")"
export UB_SOCKET=/tmp/ueberzugpp-"$UB_PID".socket
ueberzugpp cmd -s "$UB_SOCKET" -a add -i PREVIEW -x "$1" -y "$2" --max-width "$3" --max-height "$4" -f "$5"
read -r
ueberzugpp cmd -s "$UB_SOCKET" -a exit

image

should i PR it as an example in the scripts directory? it might be useful to some people i guess

@jstkdng
Copy link
Owner

jstkdng commented Jun 2, 2023

sure, it could be useful to someone else.

@justchokingaround
Copy link
Contributor Author

using this with the output set to wayland doesn't work btw, i'm not sure if i should report that or not?

@jstkdng
Copy link
Owner

jstkdng commented Jun 2, 2023

no need, there's already #55 .

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