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
Download from release
section of repo
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
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
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>/{}"