Using lf v13, the tools I've tried in order of quality & features to preview images:
With following previewer:
#!/usr/bin/env bash
# preview script
# github.com/rafi/.config
FILE="${1}"
HEIGHT="${2}"
[ -L "${FILE}" ] && FILE="$(readlink "${FILE}")"
# show file title
echo -e "\e[33m# \e[34m$(basename "${FILE}")\e[0m"
case "$(file -b --mime-type "${FILE}")" in
# image terminal view with chafa/timg/catimg/cam/imgcat
image/*)
chafa --fill=space -c 256 -s 80x"${HEIGHT}" "${FILE}" || \
timg "${FILE}" || \
catimg -r 2 -w 110 -t "${FILE}" || \
cam -H "$(echo "$HEIGHT*0.6/1" | bc)" "${FILE}" || \
imgcat --depth=256 --height "$(echo "$HEIGHT*0.9/1" | bc)" "${FILE}"
echo
exif "${FILE}"
exit 0
;;
esac
The image in lf shows up garbled:

While running chafa in terminal displays:

I've tried different color palettes (16/256), but all the characters always shows up garbled.
@rafi Keep in mind that you need to set color256 option in lf to be able to display 256 colors instead of 16. Even with 256 colors, chafa has some alignment issues. I have tried using different symbols and the following seems to work:
chafa --fill=block --symbols=block -c 256 -s 80x"${HEIGHT}" "${FILE}"
It seems that some character widths are not calculated properly.
@gokcehan thanks for the response. I've already tried that combination, but still images are completely garbled. I've tried with iTerm2 and Alacritty, in & out of tmux, none work. Can I ask you which Terminal are you using and what's the value of $TERM for you?
@rafi I'm using alacritty with $TERM value xterm-256color. Can you confirm you have set color256 in lf?
Yesss, it works. Was too early in the morning for me probably, I mistakenly thought you meant enable 256 in chafa. Thanks!
Are you planning to support 16bit colouring and those exotic unicode characters chafa uses by default?
@rafi Unicode characters should have been working already so it is a bug and we should fix that somehow. 16bit color support is difficult because termbox-go that we use for interface does not support more than 256 colors.
I have taken a look at this again. Rune widths are calculated with go-runewidth so it's likely a bug there. In any case block characters in chafa seems to work well so this is not a big issue. Feel free to add these chafa examples somewhere in the wiki. 16 bit color support may be supported if we move from termbox to tcell at some point which is tracked in another issue. Closing this issue.
Thanks to tcell, everything looks beautiful now, awesome! :)