Skip to content

terminal image viewer (ueberzug replacement)

License

Notifications You must be signed in to change notification settings

mohammad5305/reberzug

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

User-friendly ueberzug alternative

reberzug is an easy to use ueberzug alternative with simple configuration that is blazingly fast for showing images in terminal using child windows.

Currently only X11 is supported

demo

Installation

pre-built binaries

Download from release section of repo

Building from source

install rust toolchain and run

git clone https://github.com/mohammad5305/reberzug && cd reberzug
cargo build --release

The binary file will be in ./target/release/reberzug

cp ./target/release/reberzug ~/.local/bin
chmod +x ~/.local/bin

Usage

Just give width, height arguments followed by image path

reberzug -W 300 -H 500 /tmp/image.png

for downscaling/upscaling use box/nearest resize algorithms respectively

reberzug -W 300 -H 500 -r box /tmp/image.png

For more information run reberzug -h

Fzf preview

for better postioning needs xdotool to get width, height of terminal.

IFS="x" read -r WIN_WIDTH WIN_HEIGHT <<< "$(xdotool getwindowfocus getwindowgeometry | grep -ioP 'Geometry:\K.+')"

COLS=$(tput cols)
LINES=$(tput lines)

WIDTH_RATIO=$((WIN_WIDTH/COLS))
HEIGHT_RATIO=$((WIN_HEIGHT/LINES))

draw_image (){
    # 60 is supposed to be based on fontsize :)
    X=$((FZF_PREVIEW_COLUMNS * WIDTH_RATIO + 60))
    Y=$((1 * HEIGHT_RATIO))
    /tmp/reberzug -W 500 -H 300 -r box -x $X -y $Y $1
}

export WIDTH_RATIO HEIGHT_RATIO
export -f draw_image

ls -1 <path> |fzf --preview "draw_image <path>/{}"