lsix: ls for images
github.com
github.com
I find iTerm's approach is more simple yet more powerful: better compression, thus faster; no dithering, thus better image quality; it's even have GIF support. Sixel is an 30 year protocol designed for matrix printers, i'm not sure why we should stick to it. I think terminal emulators should adopt iTerm escape sequence rather than Sixel.
Aside of iTerm, image inlining is supported in Terminology[2]. Not sure about compatability with iTerm however.
I wonder if any other terminal uses the same escape sequences. If not, why not?
(Aside: I dislike the vagueness of the term "proprietary." I rarely hear anyone call the non-ANSI VT-100 or xterm sequences "proprietary," even though they got started in exactly the same way as iTerm2's.)
iTerm2 calls their escape codes proprietary[0]. As far as I can tell, they are not trying to create a standard. VT320, on the other hand, is an ANSI standard[1].
That is how standards should be made.
Then there is sixel - which solved a problem back when TTYs were VDUs but aren’t really suitable for a modern era where it’s all terminal emulators running on (U)HD displays. I don’t think sixel support is all that widespread though but happy to be corrected there.
What we really need is one CLI tool to rule them all. One tool that will detect the shell you’re using and default to the best escape sequence for that shell; falling back to ASCII art when all else fails.
This is something I’ve been actively working on in some of my spare time but it’s not ready for public consumption, yet....
However, some may be slow to render (like PDF), so lsix doesn't show them unless you ask specifically.
Regardless of the justification, I don't think creating such extra exception/edge-case behaviours are ever a good idea in a commandline tool like this. The equivalent in regular ls would be something like not showing more than X files "unless you ask specifically" --- which would just create more confusion than anything. As someone who has used the commandline for many years, one property which needs to be present for good usability is consistency. Having a bunch of edge-cases and special behaviours makes a tool hard to use for anything but the most extremely basic of operations.
One can argue whether this "starting with a . means hidden" is a hack or not, but I think it's manifestly different than not showing particular file types based on size or something like that.
I agree just not showing pdf files by default because they render slowly is a design mistake.
The story from Rob Pike is that this came about from a combination of (1) not wanting to show "." and "..", and (2) some sloppy programming in the implementation of that feature.
Why?
I, like gp, prefer consistency and predictability over unique tool-specific defaults. If every command line tool had it's own special quirks, I would need to consult man pages every single time I issue something more complex that a `cd`.
Perhaps lsix should be separated into two tools like find and locate; one that uses cached rendered previews and the other generates them on the fly.
If it didn't preview GIFs without a flag, or PNGs, then your point would absolutely stand.
Every image viewer on Earth excludes DOCs and PPTs by default, but nobody complains about that.
PDF is a weird format with a bunch of disjoint use cases.
Dolphin → Settings → Configure Dolphin… → General → Previews
Konqueror → Settings → Configure Konqueror… → File Management → General → Previews leads to the same configuration dialog.
(Source: I worked for a publishing company in the 90s)
That’s not so much the case these days and Word documents / PowerPoint presentations have supported embedding fonts too so they’ve drifted a little into PDFs territory. But from a generalised and historic standpoint: Word documents were for editing and PDFs were for printing.
CLI utils are full of special behaviors for convenience of use by people. To enable strict consistence that is mostly necessary for usage by other programs, there are flags.
Git for example will colourise terminal output if it can tell a person is interacting with it, but if a script is calling then the colour markers won't be added (and there are many many other examples of similar behaviour).
In fact a great deal of CLI tools (and particularly coreutils like GNU) will have nice usability features this will auto-disable the moment the output file is not a TTY.
For example, run the following commands and compare the output:
ls ~
ls ~ | cat
grep --color=auto ${hostname} /etc/hosts
grep --color=auto ${hostname} /etc/hosts | cat
You might be surprised at just how different and predictable the terminal utilities behave when they detect they’re being piped.I’ll grant you that hidden files being defined by a prefix on the file name is a weird quirk - but at least that’s something which is consistent across all of Linux and UNIX (including OS X) and something that all tools for those respective platforms behave the same around. And to be fair, it’s a massively old convention that made sense back before metadata was a thing so it’s not even without some rationale.
Ultimately though, the issue here is you don’t want any files hidden by default. Which is the opposite of the point of a hidden file. So you’d have the same complaint if the “hidden flag” was file system metadata (eg on NTFS) as you would want if it were a file name prefix.
Perhaps the GUI file managers are also inconsistent because they hide hidden files by default too?
Now that I think about it, pdf isn't an image type, so I'm not sure if I would expect a tool like this to handle that anyway.
toolName /somepath # process all files the tool chooses to
toolName /sompath/* # process every single file, even files it does not support (with a warning)
This is far closer to standard behavior.Nobody manipulates binary files/pixel data in bash, do they?
That's a strong word you have there.
You also have a point - I’m seriously debating if I can write one in an evening solely to say that one now exists. (I lost the debate with myself, sadly.)
EDIT: I mean “source language bash”, not “target language bash”, my emscripten friends.
In particular, the value 0 can't be stored in a bash variable, which almost completely rules out the possibility of byte-by-byte processing of general binary data. It's probably possible with absurd hacks.
Quite apart from that, error handling in bash is an awkward chore which few scripts get right. It's a very unappealing language for writing anything more than a five-line script. https://www.davidpashley.com/articles/writing-robust-shell-s...
This time next year we'll be reading about Bixel (free to use if you build it), the new hotness in binary and pixel editing.
- Sixels exist
- Konsole doesn't support them.
- I don't have xterm installed.
After installing xterm and trying this out, I'm pretty impressed. Though not impressed enough to stop using Konsole.
Does anyone have a list?
At repl.it we've been toying around with adding sixel support for xterm.js and we have a prototype up and people in our community are already building things on it.
Here are a few examples:
- gnuplot: https://gnuplot.basicer.repl.run/rob
- gif in terminal (python): https://repl.it/talk/share/SPINNING-GLOBE-GIF-WITH-SIXEL-NEW...
- connect 4 game (ruby): https://repl.it/talk/share/Connect-4-20-with-better-graphics...
What if our CLI programs could output HTML or JSON depending on whether they are piped or printed.
Both standards are not good for this, but is VT100 really that great?
I agree shells are great and PowerShell is confusing.
It's merely amazing text is still king.
Well, they can, and there are tools that read HTML data from their standard input and render it in a browser.
I don't understand the preoccupation with rendering things like this within terminal emulators. We have graphics displays, X11, and can mount anything locally. If I quickly want to view some thumbnails, I'll use feh, or maybe just a graphical file browser. If I want to view an HTML document I'll open that in my web browser. If I want to plot some data I can use gnuplot. None of this is particularly distracting to my workflow.
On the contrary, I think there is some value to having command line applications output data that is easy to parse and WYSIWYG, because its strength to me lies in the ease with which you can automate workflows using a shell operating on text data. That's sort of lost when all the data you see is filled with invisible markup. This is already the case to some lesser extent with colors and e.g. ls formatting.
RLogin (Japanese terminal emulator)
http://nanno.dip.jp/softlib/man/rlogin/
tanasinn (Works with firefox)
http://github.com/saitoha/tanasinn/
mlterm
Works on each of X, win32/cygwin, framebuffer version. http://mlterm.sourceforge.net/
XTerm (compiled with --enable-sixel option) You should launch xterm with "-ti 340" option. the SIXEL palette is limited to a maximum of 16 colors. http://invisible-island.net/xterm/
DECterm
Kermit
WRQ Reflection
ZSTEM
There's a fork that purports to add support, but it's not been updated for a while: https://github.com/yatli/tmux-sixel
> "I am not interested in graphics in the terminal and there are few practical uses for them anyway."
Really? I wonder how the *nix environment would look like today if the tools (gnu, et al) only worked with the workflows that their original creators envisioned. In fact, just recently I had to SSH into a remote server and find a particular image. The filenames are random strings, and the timestamps were useless as the files were recently copied from an archive drive without the `-a` flag. Having image support in the terminal would have saved me enough time to pick up my little one from kindergarten myself instead of having to send someone else to pick him up for me.
"lsix is a shell script that uses ImageMagick convert tool to list images on a shell screen on terminals that support the Sixel format"
There, was that so hard?!? :-(
EDIT: oops, it does mention it, everywhere actually. 1) need to pay more attention but 2) I was just venting because of so many other repos I have to spelunk to have answers for when a few words in the readme would do :-)
OTOH, when using screen, it completely poops itself. Sadface.
Also, wow, it's slow.
(caveat usor!)
It's a shame that netpbm seems to be mostly dead, it always worked much better for the kind of tasks that most people use ImageMagick for, at least for me.
EDIT: And despite the option in there being on, I can't seem to get it to output graphics instead of binary garbage when I use the "lsix" bash script.
The script seems to depend on ImageMagick "convert" for most of its work; when I run "convert -version" I see "ImageMagick 7.0.6-0 Q16 x86_64 2017-06-12", is this newer than the version you are using?
The only font designers who care about clear distinction of symbols are those who create fonts for coders
Simple clarity test:
Il10O
All 5 chars should have clear distinction. Otherwise the font is shit.
though i admit, that its become pretty normal for the I to be smaller than the l and the O to be rounder than the 0.
I'd prefer that to be even clearer. I.e. a point in the Zero or rounding the ends of the small L