10 ms·
lsix: Like "ls", but for images
- forgotpwd16 2y agoAs long as terminal used supports sixel graphics.
- kps 2y agoxterm supports sixel, so surely anything that sets TERM=xterm256-color or similar will be compatible… right? ∗cough∗ gnome-terminal ∗cough∗
- spudlyo 2y agoxterm supports sixel, so surely if your TERM is xterm-kitty, it's supported right?
- kps 2y agoI would say so, yes (not a fan of kitty's general NIH), but it could be argued that `xterm-kitty` is at least not identical to a $TERM used for xterm.
- spudlyo 2y agoIndeed. I was trying to humorously reference the author's staunch refusal to remove `xterm` from the TERM identifier, knowing full well that many programs simply look for `^xterm` when determining if the terminal is compatible. As you eluded to with 'NIH', the same author refused to implement Sixel in Kitty because it is "inferior" to Kitty's image implementation.
- SushiHippie 2y agoWhat does "NIH" mean in this context?
- throwaway290 2y agoKitty developer decided to go with a custom image display protocol instead of going with sixel.
- sn0wf1re 2y agoNot Invented Here
- 20after4 2y agohttps://en.wikipedia.org/wiki/Not_invented_here https://en.wikipedia.org/wiki/Not_invented_here - When someone or some group prefers to re-invent something rather than using an existing, perfectly serviceable solution.
- alexvitkov 2y agoWhy do we now have User-Agent in the terminal ;-;
- boomboomsubban 2y agoIsn't the TERM variable ancient? I know one of the "common" exported variables is the VT100, sold in 1978.
- hollerith 2y agoYes, it is very old.
- dheera 2y agoI wrote a graphics library for non-sixel terminals https://github.com/dheera/python-termgraphics https://github.com/dheera/python-termgraphics Might be interesting to mod this library to support this as a fallback.
- wonger_ 2y agoLooks good! I've seen a few such libraries. My favorite is chafa: https://hpjansson.org/chafa/ https://hpjansson.org/chafa/
- tambourine_man 2y agoA labor of love, congratulations.
- ok123456 2y agomlterm works
- spudlyo 2y agoIn case you're like me, and you wouldn't think of using a terminal without Tmux, the experimental sixel branch was finally merged[0] as of about 10 months ago. This means you can finally build mainstream Tmux with --enable-sixel and use tools like lsix in Tmux! If you're curious if your favorite terminal or multiplexer supports sixel, you can check out the "Are We Sixel Yet"[1] site. [0]: https://github.com/tmux/tmux/commit/dfbc6b1888c110cf0ade66f20188c57757ee1298 https://github.com/tmux/tmux/commit/dfbc6b1888c110cf0ade66f2... [1]: https://www.arewesixelyet.com https://www.arewesixelyet.com
- emptysongglass 2y agoI'm not sure I understand the use of tmux. Can someone explain why it's essential to their workflow and why it might end up being essential to mine?
- spudlyo 2y agoTmux provides a means multiplexing a single terminal window into multiple terminals, either full screen, or like a tiling window manager. It lets you organize and label these terminals and provides a very flexible keyboard interface to terminal management, including history scrollback, search, etc. I started using GNU Screen in the early 90s, and over the years I have developed a keyboard muscle memory for managing multiple terminals in this fashion that is completely independent from whatever terminal program I'm using. This allows me to utilize this keyboard muscle memory if I'm using iTerm2 on macOS, Windows Terminal, or Alacrity on Linux. Many fancy terminal programs offer some subset of these multiplexing features (like tabs) and such, but in my experience none of them are as configurable or as feature rich as Tmux.
- lynndotpy 2y agoIt's also very good if you're SSHing over an unreliable connection. The tmux terminal doesn't break when your connection does.
- 2y ago
- avhception 2y agoThe example screenshots feature a terminal with a "foo@kremvax" prompt, nice touch :D
- sebnukem2 2y agoQuite the list of deps (from brew install): dependencies for lsix: bash, libpng, freetype, fontconfig, jbig2dec, jpeg-turbo, libidn, libtiff, little-cms2, openjpeg, ghostscript, brotli, giflib, highway, imath, openexr, webp, jpeg-xl, libvmaf, aom, libde265, glib, shared-mime-info, x265, libheif, liblqr, jasper, libomp, libraw, m4, libtool and imagemagick
- bee_rider 2y agoA lot of them seem pretty reasonable, I wonder though if it would benefit from some optional dependency based scheme
- pepa65 2y agoNot really, imagemagick is the only package it needs installed (apart from bash and coreutils).
- dylan604 2y agoif you want to look at media, you gotta have the proper codecs--and there's a lot of them. that's what the majority of them are. have you seen some of the dependency trees for npm packages? not really sure your point here
- p_l 2y agoMajority are simply to support opening different types of graphics (still and moving) files. Some are necessary just for the build process. All in, I'd say it has remarkably little in dependencies that aren't directly connected to fulfilling the job it's supposed to do (bash, libtool, m4 - looks like build time does; libomp, highway, imath - useful optimization libraries; glib - living in C land is a PITA; shared-mime-info - useful for file type recognition and handling) and I would be totally unsurprised if some of them weren't transitive deps anyway (esp. libomp and highway). So I'd say it's very light on dependencies.
- arp242 2y agoPretty much all of these are dependencies of imagemagick, because that supports tons of image formats, often via things like lib$format. The script itself just depends on bash, imagemagick, and a few standard shell tools like sed.
- Aldipower 2y agoThe HN font is very misleading here. I am waiting for the next headline: 'Isis, like "ls", but for terrorists.'
- neilv 2y agoDo the filenames work with text selection? (Looks like they might only be in the pixmaps, not accessible as text to the terminal.)
- ydant 2y agoThey don't (on iTerm2), which makes this of fairly limited utility for me, since my next operation would be to copy the filename and act on it. I mainly use a modified version of iTerm2's imgcat script for browsing images (remotely through SSH and locally) and knowing the filename. This lsix tool is faster than my imgcat based script, though, so it looks like I have some room for tweaking/improving.
- vidoc 2y agoSee, that is pure genius!
- thecosmicfrog 2y agoI think my favourite feature of this repo is the `README.md.d` directory. That's actually a nice idea. Could maybe drop the `.md` I guess.
- enriquto 2y ago> I think my favourite feature of this repo is the `README.md.d` directory. The real power move here would be to embed the images as verbatim sixel inside the README file. Thus you could cat README and see them in all their glory.
- smarm52 2y agoSomething interesting might be to mix in object detection in images, for something like: `lsix --search cat` And find all the images that contain cats.
- Zhyl 2y agohttps://xkcd.com/1425/ https://xkcd.com/1425/
- Guillaume86 2y agoThat comic lost some meaning in recent years, you could put out some decently accurate bird detection model by following a 30 mins YouTube video, it was even one of the first exercice in some ML youtube courses (can't remember the channel).
- Zhyl 2y agoBut it still retains some meaning. Using a glob pattern to wildcard files with the same name vs. running an image entity classifier across 1 to n images in potentially recursive directories. In a command line utility for displaying files.
- sva_ 2y agoMaybe more in the sense of the Unix philosophy: The detection should happen in a separate tool of which the output filenames can then be piped into lsix.
- vunderba 2y agowell sure. But if you were building this for actual usage, you'd have a separate cron-style tool that would monitor your picture folder (and its subdirectories) for new images. Feed aforementioned image into Llava or any number of image classifier APIs, embed classification information as IPTC data into the image file. Then give the CLI flag for the search tool the ability to do partial word search on metadata within images.
- 2y ago
- omoikane 2y agoUses "\e[c" to automatically detect sixel support: https://github.com/hackerb9/lsix/blob/3a431793a747df3f9340519555527da9b10d040a/lsix#L86 https://github.com/hackerb9/lsix/blob/3a431793a747df3f934051... "\e[c" is "send device attributes": https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-F...
- aftbit 2y agoBe careful running this on an untrusted directory, especially with e.g. pdfs, just like anything else that parses images, especially using ImageMagick.
- aniviacat 2y agoIs parsing untrusted images inherently problematic? If I open my (untrusted) downloads folder using Gnome Files and it displays (and therefore parses) the contained images, is that a security issue I should be concerned about? (I would have assumed that (e.g.) Javascript in PDFs could be problematic, but not a simple preview.)
- J_tt 2y agoUnfortunately, it can be a vector[0], especially on less security focused software that has less sandboxing. 0: https://www.cvedetails.com/vulnerability-list/vendor_id-7294/Libpng.html?page=1&order=3&trc=47&sha=411afff6690d97dd25405fb43da5dfe802eb4a71 https://www.cvedetails.com/vulnerability-list/vendor_id-7294...
- tedunangst 2y agoRandom example that doesn't even require opening the directory. https://github.blog/2023-10-09-coordinated-disclosure-1-click-rce-on-gnome-cve-2023-43641/ https://github.blog/2023-10-09-coordinated-disclosure-1-clic...
- metadat 2y agoAwesome idea, but doesn't work under PuTTY/KiTTY: $ lsix Error: Your terminal does not report having sixel graphics support. Please use a sixel capable terminal, such as xterm -ti vt340, or ask your terminal manufacturer to add sixel support. You may test your terminal by viewing a single image, like so: convert foo.jpg -geometry 800x480 sixel:- If your terminal actually does support sixel, please file a bug report at http://github.com/hackerb9/lsix/issues Please mention device attribute codes: ^[[?6c Too bad! That would be pretty spiffy. Is there an open-source windows terminal which supports Sixel? Mostly seems only Cygwin or WSL stuff out there, nothing pure?
- krs_ 2y agoI started using wezterm recently and really like it. It's cross platform and supports sixel graphics. https://github.com/wez/wezterm https://github.com/wez/wezterm
- krs_ 2y agoI can no longer edit my post. I just saw that apparently it doesn't work with wezterm on Windows. Sorry about that. https://github.com/hackerb9/lsix/issues/69 https://github.com/hackerb9/lsix/issues/69
- shrx 2y agoI don't really like that they're including so much non-core functionality. Why should a terminal emulator provide its own multiplexer, ssh client and serial connection libraries, instead of using those already available on the operating system?
- jph00 2y agoMintty is an excellent windows terminal with sixel support fyi.
- ThrowawayTestr 2y agoThe lengths people will go to avoid leaving the terminal
- oalders 2y agofzf has "(Experimental) Sixel image support in preview window (not available on Windows)" since version 0.44.0 https://github.com/junegunn/fzf/releases/tag/0.44.0 https://github.com/junegunn/fzf/releases/tag/0.44.0 fzf --preview='fzf-preview.sh {}'
- dandanua 2y agoAlternatively, fzf --preview 'convert {} -geometry 800x480 sixel:-'. It also requires ImageMagick installed.
- snvzz 2y agoGets some points for referencing Kermit in its documentation.
- EnigmaFlare 2y ago"However, some may be slow to render (like PDF), so lsix doesn't show them unless you ask specifically." This kind of arbitrary special case can often be aggravating in software. Something's mysteriously not working for some reason and you have to hunt around to work out how to "fix" it. I'd rather see it being slow on some files (which is understandable) and if it's a pain, look for an option to skip slow files.
- aejm 2y agoThis seems like a reasonable point. Add an option to skip slow files if needed, but don’t skip them by default as it leads to unexpected behavior
- oxygen_crisis 2y agoiTerm2 for MacOS has similar functionality baked in, but less demanding on the server side. Rather than using a ton of server-side image libraries to render the picture into sixels on the server, it just sends a base64-encoded copy of the whole image to the client where it can determine the image type and render it into the terminal locally. https://iterm2.com/documentation-images.html https://iterm2.com/documentation-images.html
- qiqitori 2y agokonsole implemented the same protocol; I use their unmodified imgcat script on Linux. It's of course much faster than converting using imagemagick, still added lsix to my bin directory for now. :)
- smcameron 2y agoAlong similar lines, timg : https://github.com/hzeller/timg https://github.com/hzeller/timg
- 8xeh 2y agoAnother that I've used: https://github.com/posva/catimg https://github.com/posva/catimg
- franky47 2y agoUnfortunate capitalisation, it took me a copy-paste to realise the first letter is a lowercase L, and not an uppercase i.
- 8organicbits 2y agoThe name is at least consistent. "ls with sixel" => "ls six" => "lsix"
- rurban 2y agoAnyone knows why the hell the most used terms do have no sixel support? The libvte based ones. And I'd really like to see exiftag support, like the ImageDescription, in the long form. And I would be a bit concerned about security, but it's certainly not as dangerous as unicode
- aargh_aargh 2y agohttps://gitlab.gnome.org/GNOME/vte/-/issues/253 https://gitlab.gnome.org/GNOME/vte/-/issues/253
- qwertox 2y agoThis is a great tool. It works without problems with Mintty and I'm confused about how it manages to draw individual pixels in the terminal. It's the first time I try such an image viewer and I feel so relieved to not have to download images to view them anymore (or to view them in VS Code).
- ceving 2y agoSadly Emacs does not support VT340.
- ykonstant 2y agoAre there any plans to support the features? Or is it just not a direction for the devs?
- tredigi 2y agoOh that's great! Finally a way to server-side getting pwned right in the shell with the next imagemagick security hole!
- mehdix 2y agoI wish we had all these goodies in default linux console (I know about and try to use kmscon sometimes...)