lf icon indicating copy to clipboard operation
lf copied to clipboard

Preview isn't working for True Color Images

Open 4volodin opened this issue 4 years ago • 13 comments

Image Preview not working LF r21 (macOS 11.2.3, iTerm2)

  1. I checked terminal supporting true colors using .sh script from here in LF preview it looks in command line terminal it looks
  2. I tested on real images if I use chafa -c full image.jpg - in LF preview it looks and here if I use timg -pi image.jpg - in LF preview shows only blank screen for .jpg after "loading...", Although in the command line is everything OK, images are displayed in TRUE COLOR colors here

TRUECOLOR images are displayed correctly only in the terminal. In lf preview it doesn't work

I think the LF not supporting TRUE COLOR for me

How to fix it?

4volodin avatar Apr 12 '21 08:04 4volodin

I consider replacement termbox-go to tcell didn't solve the problem https://github.com/gokcehan/lf/issues/473#issuecomment-748513239

https://github.com/gokcehan/lf/issues/223

4volodin avatar Apr 12 '21 14:04 4volodin

@4volodin I tried chafa -c full ... in my previewer script and it works for me. This might be a configuration issue on your side. You may need to provide more details. I tried this with two terminals without a problem. I can't test it on iterm2 as I don't have a mac. If this is a terminal issue, you may need to wait for other people to work this out. Or you can try it on different terminals yourself.

gokcehan avatar Apr 13 '21 22:04 gokcehan

The same things on Kitty and Wezterm terminals screen Kitty and Wezterm Kitty on the top Wezterm on the bottom

4volodin avatar Apr 14 '21 05:04 4volodin

@4volodin So then it's not likely a terminal issue as I can't reproduce this on kitty myself. You need to provide more details like your config file and preview script.

gokcehan avatar Apr 14 '21 11:04 gokcehan

my dotfiles here

4volodin avatar Apr 15 '21 07:04 4volodin

@4volodin I tried with your config and previewer, still can't reproduce it. Sorry, I don't know what it is. Try upgrading to the latest r22 version to see if it helps. Other than that I can't think of anything else.

Also, there is no such thing as set hidden true, instead it should simply be set hidden, or in the opposite case set nohidden. See syntax section in the doc for more info.

gokcehan avatar Apr 15 '21 08:04 gokcehan

Unfortunately, r22 didn't help (

4volodin avatar Apr 15 '21 11:04 4volodin

@4volodin Maybe it's the chafa version then as it's working with the color script. I have been trying with 1.4.1. Also can you confirm you're not using a custom $TERM value?

Colors should be interpreted here so I don't see how they come out raw. Also please check your log file to see if there is anything relevant.

gokcehan avatar Apr 15 '21 12:04 gokcehan

$chafa --version 
Chafa version 1.6.0

//for iTerm
$echo $TERM
xterm-256color

//fot Kitty 
$echo $TERM
xterm-kitty

$echo $LS_COLORS

output is empty

I'm not using custom $TERM

4volodin avatar Apr 15 '21 13:04 4volodin

It's interesting that another terminal image viewer timg in kitty and iTerm2 displays full TrueColor images as original but in lf-previewer timg outputs nothing

4volodin avatar Apr 15 '21 13:04 4volodin

@4volodin I was able to reproduce the error with chafa version 1.6.0. It seems that chafa merged foreground and background escape codes in this version, which exceeds our lookahead length for color escape recognition. I bumbed the length from 32 to 64 now which I think should be enough for all cases. You can try it yourself if you build master from the source, otherwise you need to either wait for next release, or use chafa version 1.4.1 which does not trigger this issue.

I really wasn't expecting a bug out of this issue. Thanks for reporting.

gokcehan avatar Apr 15 '21 14:04 gokcehan

I will wait for the next release and I consider it also fixes the error with timg image viewer Thanks for helping

4volodin avatar Apr 15 '21 15:04 4volodin

@4volodin I was able to reproduce the error with chafa version 1.6.0. It seems that chafa merged foreground and background escape codes in this version, which exceeds our lookahead length for color escape recognition. I bumbed the length from 32 to 64 now which I think should be enough for all cases. You can try it yourself if you build master from the source, otherwise you need to either wait for next release, or use chafa version 1.4.1 which does not trigger this issue.

I really wasn't expecting a bug out of this issue. Thanks for reporting. Hello There are some artifacts

timg -g30x30 "${FILE}" image

chafa -c full -s "${WIDTH}x" "${FILE}" image

lf -version 26

timg -version 1.4.4

chafa -version 1.8.0

4volodin avatar Feb 28 '22 05:02 4volodin