xlucn / fontpreview-ueberzug

preview fonts in fzf
MIT License
164 stars 11 forks source link

Using Background and foreground colors causing preview corruption #22

Closed manujchandra closed 10 months ago

manujchandra commented 10 months ago

When I call:

fontpreview-ueberzug

Correct preview is generated

Screenshot_2024-01-30_11-13-35

If I use background and foreground colors:

fontpreview-ueberzug -b '#272822' -f '#f8f8f2'

Screenshot_2024-01-30_11-13-22

I get the above result.

Tried in both XFCE terminal and Alacritty.

Environment:

xlucn commented 10 months ago

Thanks for the report. I can reproduce it.

However, if you could try to open the image /tmp/fontpreview-ueberzug-img.png with other image viewers while running fontpreview, please check if it is shown with the right color.

If confirmed, the issue might be: either fontpreview generates the image in a somehow weird format, or ueberzugpp parses that image in a somehow weird way. Something is not done by the standard. I will look further into it.

xlucn commented 10 months ago

Okay, I found that currently ueberzugpp 2.9.2 can't display most of the png images fontpreview generates. As a workaround, I have moved from png to jpeg format, which I tested without issues. You can try that with the latest master branch.

manujchandra commented 10 months ago

Just for the sake of completion, I can view /tmp/fontpreview-ueberzug-img.png properly on sxiv

Screenshot_2024-01-30_15-52-03

Thanks for such a prompt reply. Let me try the master branch. 🙏🏽

EDIT : I have tried the new master branch and it seems to be working fine!

xlucn commented 10 months ago

I think the reason is that fontpreview was somehow generating images with 16-bit color depth, and ueberzugpp can't deal with that. If interested, see the mentioning issue above this comment.

So, I think my workaround is fine. I could also generate png images in 8-bit color depth (already tested), but there seems no need for the change.

As for this issue, I am closing it now since the problem is not at my end anymore.