libsixel
libsixel copied to clipboard
VT-340 support
I think libsixel should support VT-340. But I don't have any DEC's terminal. Please tell me current problems on it.
Thank you for your attention to this! Here's what I've noticed so far.
-
The VT340 uses colors 0, 7 and 15 to display text. A shared palette for mixing images and text, as you'd need for w3m or mikutterm, needs to be constructed with this in mind. However, it doesn't seem to be possible to deliver a color palette to img2sixel and actually have it keep it in the order you want. You get the right colors, but they're the wrong way around.
-
A 9600 baud serial link is just too slow to play animations on. It would be nice if img2sixel had an option to display only the first frame of an animation.
Thanks for your information.
-
I think img2sixel should provide an option for specifying built-in color configuration. I'll implement it as referencing color tables in this page. Furthermore, we have to improve -m(--map) option so that it keeps color order of specified color map files (and now it seems -m option is buggy if it is compiled with libpng/libjpeg).
-
The -S(--static) option may be what you want.
I cherry-picked your commit(4485ca0) into master and added new alternative option(-b, --builtin-palette) instead of -x/-y.
-b BUILTINPALETTE, --builtin-palette=BUILTINPALETTE
select built-in palette type
xterm16 -> X default 16 color map
xterm256 -> X default 256 color map
vt340mono -> VT340 monochrome map
vt340color -> VT340 color map
This feature is released with libsixel 1.4.
I'm sorry it took so long to get back to you!
Your code works correctly. However, it turns out the VT340 has some undocumented behavior regarding the color palette: it loads the first fifteen colors as 1 through 15, and loads the sixteenth color as 0.
I got the desired palette by changing the definition to this:
static const unsigned char pal_vt340_color[] = {
/* 1 Blue */ 20 * 255 / 100, 20 * 255 / 100, 80 * 255 / 100,
/* 2 Red */ 80 * 255 / 100, 13 * 255 / 100, 13 * 255 / 100,
/* 3 Green */ 20 * 255 / 100, 80 * 255 / 100, 20 * 255 / 100,
/* 4 Magenta */ 80 * 255 / 100, 20 * 255 / 100, 80 * 255 / 100,
/* 5 Cyan */ 20 * 255 / 100, 80 * 255 / 100, 80 * 255 / 100,
/* 6 Yellow */ 80 * 255 / 100, 80 * 255 / 100, 20 * 255 / 100,
/* 7 Gray 50% */ 53 * 255 / 100, 53 * 255 / 100, 53 * 255 / 100,
/* 8 Gray 25% */ 26 * 255 / 100, 26 * 255 / 100, 26 * 255 / 100,
/* 9 Blue* */ 33 * 255 / 100, 33 * 255 / 100, 60 * 255 / 100,
/* 10 Red* */ 60 * 255 / 100, 26 * 255 / 100, 26 * 255 / 100,
/* 11 Green* */ 33 * 255 / 100, 60 * 255 / 100, 33 * 255 / 100,
/* 12 Magenta* */ 60 * 255 / 100, 33 * 255 / 100, 60 * 255 / 100,
/* 13 Cyan* */ 33 * 255 / 100, 60 * 255 / 100, 60 * 255 / 100,
/* 14 Yellow* */ 60 * 255 / 100, 60 * 255 / 100, 33 * 255 / 100,
/* 15 Gray 75% */ 80 * 255 / 100, 80 * 255 / 100, 80 * 255 / 100,
/* 0 Black */ 0 * 255 / 100, 0 * 255 / 100, 0 * 255 / 100,
};
Perhaps a command line option to rotate the palette?
@vrtsds Thanks for your investigation! I pushed 29fcda3 into hotfix branch. It will be merged into master soon. For now, I won't create the option to rotate the palette.
@vrtsds I uploaded a test sixel data for VT-340 with considering rotation. http://zuse.jp/misc/vt340test.six If it is displayed correctly, I will send the following patch to XTerm. https://gist.github.com/saitoha/3a6c3bdcc45cf24ddcf1
The sixel commands in the test data don't appear to set a color palette at all.
@vrtsds I removed the palette section from this sixel data because I wanted to know the default palette state of VT-340. If you type as follows, can't you get anything?
$ cat vt340test.six
I had to factory reset the terminal to get the default palette. It isn't the one I had saved.
