gokcehan / lf

Terminal file manager
MIT License
7.61k stars 324 forks source link

Preview isn't working for True Color Images #609

Open 4volodin opened 3 years ago

4volodin commented 3 years ago

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 usetimg -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 commented 3 years ago

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

gokcehan commented 3 years ago

@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.

4volodin commented 3 years ago

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

gokcehan commented 3 years ago

@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.

4volodin commented 3 years ago

my dotfiles here

gokcehan commented 3 years ago

@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.

4volodin commented 3 years ago

Unfortunately, r22 didn't help (

gokcehan commented 3 years ago

@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.

4volodin commented 3 years ago
$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 commented 3 years ago

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

gokcehan commented 3 years ago

@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.

4volodin commented 3 years ago

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

4volodin commented 2 years ago

@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