hackerb9 / lsix

Like "ls", but for images. Shows thumbnails in terminal using sixel graphics.
GNU General Public License v3.0
3.97k stars 129 forks source link

transparent background? #52

Open Astrantia opened 2 years ago

Astrantia commented 2 years ago

hello and thanks for the project.

is it possible to set the montaged gallery background to transparent color? I tried setting montage "${onerow[@]}" $imoptions -background none gif:- | convert - -background 'rgba(0,0,0,0)' sixel:- but it doesn't seem to work. Does sixel not support viewing transparent background or what could be wrong?

hackerb9 commented 2 years ago

The sixel format supports 1-bit transparency, but ImageMagick does not know how to do that yet. The best we can do until that bug is fixed is to detect the terminal's background color and use that. It's not a bad solution as it means we also get antialiased fonts and drop shadows. Does your terminal not report the correct background color? Or, are you using an image or transparent background in your terminal?

Astrantia commented 2 years ago

The sixel format supports 1-bit transparency, but ImageMagick does not know how to do that yet. The best we can do until that bug is fixed is to detect the terminal's background color and use that. It's not a bad solution as it means we also get antialiased fonts and drop shadows. Does your terminal not report the correct background color? Or, are you using an image or transparent background in your terminal?

lsix is correctly detecting my terminal's background color, but i've set my terminal itself to be 70% transparent, so the background color ends up being a solid color. from what i gather from your reply, it is impossible to get a no-color background currently with imagemagick?

hackerb9 commented 2 years ago

from what i gather from your reply, it is impossible to get a no-color background currently with imagemagick?

Correct. And I'm not even sure that it would look good if it did work. You would lose antialiasing, so it may look grotty.

lsix is correctly detecting my terminal's background color, but i've set my terminal itself to be 70% transparent, so the background color ends up being a solid color.

That makes sense. Can you please send a screenshot of the problem and let me know which terminal you're using? While there's no fix at the moment, I'd like to keep this bug open as a reminder that sixel transparency needs further work and to try some experiments to see if it is worth pursuing.

If you could also run lsix > opaque.six and attach that file to this bug, I'd appreciate it. I will see if I can make it transparent and how it looks when I do. Thanks!

steven-omaha commented 2 years ago

I just ran into the same problem. Here is how it looks for me.

Screenshot: screen

sixel file: https://gist.githubusercontent.com/steven-omaha/0a5e2f8927be5866d8b666e7efffd661/raw/520a08bac24b57d59418d938c9050c042ee75213/opaque.six