danielgatis / imgcat

Display images and gifs in your terminal.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Imgcat and Vifm

jiDOK opened this issue · comments

commented

Thanks a lot for Imgcat! It's the only way I have found to preview images in a Windows command prompt.

I am trying to get Imgcat and Vifm work together on Windows 10, using Imgcat to show images in Vifm's preview pane.

Imgcat works fine by itself in cmd prompt but it does not seem to work from Vifm, producing the error message:
failed to get the console state: The handle is invalid.

Since I wasn't sure where the problem is rooted, I first asked over at Vifm. From what I understand Vifm expects some kind of output while Imgcat prints directly to the console.

A workaround was tried but didn't help. Here's the Question over at Vifm's github for reference:
vifm/vifm#671

I am not sure if it is possible on Windows at all, but could Imgcat be made to give Vifm the right output somehow?

can you provide a simple vimrc with Vifm and imgcat configured?

I pushed a new version with this fix: 9e5d4ab.

Can you do a test with this version https://github.com/danielgatis/imgcat/releases/tag/v1.0.6?

commented

I'm not at home, but will do later and report, thanks!

commented

It seems to be close, but not quite!

I have this in the vifmrc:

fileviewer {*.bmp,*.jpg,*.jpeg,*.png,*.gif,*.xpm}
         \ imgcat %"c

and I get this result:
Imgcat01
while it should look like this:
Imgcat02
Edit: using %pd does not work, result is a lot of text in the console after closing Vifm.

looks like the true colors are not supported

commented

Oh, I see. Xaizek wrote over at Vifm: "I looked at imgcat again and it prints 24-bit escape codes, which Vifm doesn't interpret. So if requirement about output being directly to the console is lifted, you'll still need to add %pd."
Sounds like this is related?

Oh, I see. Xaizek wrote over at Vifm: "I looked at imgcat again and it prints 24-bit escape codes, which Vifm doesn't interpret. So if requirement about output being directly to the console is lifted, you'll still need to add %pd."
Sounds like this is related?

yep! You need to add support to 24-bit color on Vifm to make it works.

commented

So from what I understand it is not easily possible to add 24-bit color support because of the library Vifm uses on Windows (PDCurses). (Xaizek's answer is in the Vifm-Issue I linked at the top)

So unless you want to add an 8-Bit color mode it's just not compatible on Windows. Since that probably would be a bigger feature request, I'll close the Issue. Thank you for your help!