Menu

#2828 Transparent sixelgd option doesn't work

None
pending-accepted
nobody
None
2025-09-04
2025-09-02
No

Steps to reproduce:

  1. set terminal sixelgd transparent
  2. plot sin(x)

This should render the graph with a transparent background, but it doesn't. This is because the Sixel background select parameter isn't correctly set. It can be fixed with the following patch:

diff --git a/term/sixel.c b/term/sixel.c
index 382a84e..9a1d617 100644
--- a/term/sixel.c
+++ b/term/sixel.c
@@ -616,7 +616,7 @@ gdImageSixel(gdImagePtr im, FILE *out, int maxPalet, int optTrue, int optFill)
     if ( !optTrue )
    Histogram(im, back);

-    fprintf(out_fp, "\033Pq\"1;1;%d;%d\n", map_width, map_height);
+    fprintf(out_fp, "\033P9;1q\"1;1;%d;%d\n", map_width, map_height);

 #ifdef USE_SIXEL_INITPAL
     if ( !optTrue ) {

The first parameter (the 9) sets the aspect ratio to 1:1. This isn't strictly necessary, because it's also later set by the raster attributes command, but this ensures a fallback if that command isn't supported.

The second parameter (the 1) tells the terminal not to fill the background, so when you omit pixels from an image, they'll actually be transparent. This is the essential change that should fix the bug.

I've confirmed that this patch gets transparency working on several Sixel terminals, including Foot, Contour, MLTerm, WezTerm, Windows Terminal, and XTerm.

It also fixes an issue on some terminals where you get an unwanted black bar at the bottom of the image (this is an undesirable side effect of the background fill that can occur when an image is scrolled).

Discussion

  • Ethan Merritt

    Ethan Merritt - 2025-09-02

    Thank you.
    For what it's worth neither the original nor the patched version work correctly in the KDE konsole terminal. But I can confirm that the patched version works better in wezterm.

    I am reclassifying this as a bug report so that the commit message can refer back to it.

     
    • James Holderness

      neither the original nor the patched version work correctly in the KDE konsole terminal

      Sorry I should have mentioned that. There are a number of Sixel terminals on which this is not expected to work (at least not any better than it did before), because they simply don't support transparency. In the case of Konsole, they've got an open issue tracking that functionality here: https://bugs.kde.org/show_bug.cgi?id=479125

       
  • Ethan Merritt

    Ethan Merritt - 2025-09-02

    Ticket moved from /p/gnuplot/support-requests/308/

    Can't be converted:

    • _milestone:
    • _priority: 5
     
  • Ethan Merritt

    Ethan Merritt - 2025-09-04
    • status: open --> pending-accepted
    • Group: -->
    • Priority: 5 -->
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.