chafa
chafa copied to clipboard
How to avoid extra band with Sixels
Using the option -s, I keep getting a band at one edge of the image. Is this a feature of using Sixels or is it there an option I am missing? See the examples below:
See the green band at the bottom (using -s 50x20):
See the white band on the right (using -s 50x19):
What does chafa --version say? We've had a bit of back and forth on sixel transparency, since different terminals handle this differently. I think we finally got it right in version 1.14.3.
It says:
Chafa version 1.14.4
Loaders: GIF JPEG PNG QOI SVG TIFF WebP XWD
Features: mmx sse4.1 popcnt avx2
Applying: mmx sse4.1 popcnt avx2
Copyright (C) 2018-2023 Hans Petter Jansson et al.
Incl. libnsgif copyright (C) 2004 Richard Wilson, copyright (C) 2008 Sean Fox
Incl. LodePNG copyright (C) 2005-2018 Lode Vandevenne
Incl. QOI decoder copyright (C) 2021 Dominic Szablewski
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
Looks like a persistent bug, then. Have you tried -t .01 as a workaround?
Also, which terminal are you on?
Thank you. I tried -t .01 but got the same band. I am using iTerm2 Build 3.5.5.
Thanks. I think this is likely specific to iTerm2 output.
Thank you. My workaround for now is to set the background to black in iTerm2, and use -t 1.0 in Chafa.
Ok. This works fine on the terminals I have access to on Linux/Windows, and unfortunately I don't have Mac hardware to test with, but I'll look into getting it installed in a VM. I have a few other things to attend to first, though.
In the meantime I have two questions for you:
- Do transparent sixels from other programs display fine? E.g.
lsix,convertwith an image with an alpha channel. - Does your test case display correctly in other terminals you have access to, if any? E.g. Wezterm.
Thank you for the followup. I don't h ave lsix or convert installed, but I have tested it in Wezterm and it works well. In fact Chafa doesn't need sixel in Weztermn.
There's a decent chance this is fixed in the master branch now. If testing it is impractical, I recommend trying with the imminent 1.16 release.
Thank you for keeping an eye on this issue. Unfortunately, the new release (1.16.1) doesn't solve the issue in iTerm (3.5.14).
FYI, I believe iTerm2 uses libsixel for its sixel decoding, and I don't think libsixel supports transparency. So if chafa is using transparent pixels to pad the image to a cell boundary, it wouldn't surprise me if that doesn't work correctly.
If you don't have access to a Mac to test with, I reckon you could get a good idea of how it's going to turn out by running the output through libsixel's sixel2png utility.
Might also be worthwhile raising an issue on the iIerm2 issue tracker to double check whether I'm correct about it not supporting transparency. I think George maintains a fork of libsixel, so he may even be able to add transparency support.